想要在asp.net中确认框 [英] want confirm boxes in asp.net
本文介绍了想要在asp.net中确认框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
想要一个简单的确认框,使用javascript,/ jquery / extjs,带有是/否按钮
解决方案
Java脚本
if (确认( 您的消息))
return true ;
else
return false ;
ASP.Net没有自己的确认/警告框。您可以使用javascript作为简单的确认框,或者如果你想要花哨的那些,那么去jQuery;除此之外,您可以使用ASP.Net创建自定义对话框。
向页面添加javascript函数,当您执行操作时将调用该函数...
< script 类型 = text / javascript >
function ConfirmAction(){
< span class =code-keyword> var result = window .confirm( < span class =code-string>您确定要执行此操作吗?);
返回结果;
}
< / 脚本 >
要调用javascript函数,请使用控件的OnClientClick事件。 ..
< asp:button id = btnDoAction runat = server text = 执行操作 < span class =code-attribute> onclientclick = javascript:return ConfirmAction(); / > 跨度>
want a simple confirm box using javascript,/jquery/extjs with yes/no buttons
解决方案
Java script
if (confirm("your message")) return true; else return false;
ASP.Net doesn't have it's own confirm/alert boxes. You can either use javascript for a simple confirm box or if you want fancy ones then go for jQuery; other than that you can create your custom dialogs using ASP.Net.
Add a javascript function to the page, the function will be called when you do your action...
<script type="text/javascript"> function ConfirmAction() { var result = window.confirm("Are you sure you want to do this action?"); return result; } </script>
To call the javascript function, use the OnClientClick event of the control...
<asp:button id="btnDoAction" runat="server" text="Do Action" onclientclick="javascript:return ConfirmAction();" />
这篇关于想要在asp.net中确认框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文