本文介绍了jQuery插件:从asp.net调用jConfirm(后面的代码)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用jquery 插件,但我陷入了困境如何从后面的代码显示确认窗口,以及用户是否选择确定"而不是继续删除,否则请忽略.
i am using jquery plugin and i got stuck in how to display the confirmation window from code behind and if the user choose "ok" than go ahead delete otherwise ignore.
jConfirm('Can you confirm this?', 'Confirmation Dialog', function(r) {
jAlert('Confirmed: ' + r, 'Confirmation Results');
});
有人做过类似的事情吗?
anybody have done similar?
推荐答案
它不适用于JConfirm,我决定使用JS
it did not work with JConfirm i decided to go with JS
//Aspx:
<asp:LinkButton ID="LinkButton1" runat="server" Text="Click Me"
onclick="LinkButton1_Click" />
//JS
<script type="text/javascript">
function MyMethod()
{
if(confirm('Are you sure?'))
{
alert('Deleted');
return true;
}
else
{
alert('Not Deleted');
return false;
}
}
</script>
//Code Behind (C#)
protected void Page_Load(object sender, EventArgs e)
{
LinkButton1.Attributes.Add("onclick", "return MyMethod();");
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
}
这篇关于jQuery插件:从asp.net调用jConfirm(后面的代码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!