服务器端混淆消息 [英] Server side confimation message

查看:126
本文介绍了服务器端混淆消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在asp.net中的服务器端代码中显示确认消息

how to show the confirmation message in sever side code in asp.net

推荐答案

服务器端-代码隐藏-是 - 否 - 认可 - 消息箱中-ASPNet.aspx [ ^ ]



http:/ /forums.asp.net/t/1904944.aspx [ ^ ]


以下代码段可以帮助您:



The below snippet may help you:

<asp:button id="Button1" text="Delete" onclick="CallDeleteFunction" onclientclick="return ConfirmOnDelete();" xmlns:asp="#unknown" />
<input id="hidden_Value" type="hidden" runat="server" />







<script type="text/javascript">
function ConfirmOnDelete()
{
var ret=confirm('Do you want to delete the item?');
if (ret==true)
{
document.getElementById('hidden_Value').value="OK";
}
else
{
document.getElementById('hidden_Value').value="Cancel";
}
}
</script>



代码落后:




Code behind:

public void CallDeleteFunction(object sender, Eventargs e)
{
string hiddenVar=hidden_Value.Value;
if(hiddenVar=="OK")
{
Call some delete operation....
}

else
{
Do nothing....
}

}





希望它有所帮助。

-Anurag



Hope it helps.
-Anurag


这篇关于服务器端混淆消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆