如何在asp.net中显示弹出是/否消息框 [英] How to show the Popup Yes/No Message box in asp.net

查看:76
本文介绍了如何在asp.net中显示弹出是/否消息框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当有人点击保存按钮时,我想用数据库验证一些输入细节,如果验证从数据库返回一些内容,则显示弹出窗口的是或否,如果是,则继续。

When someone click the Save button, i want to validate some input details with database and if the validation return something from the database, show the popup window with Yes or No, if Yes then proceed.

推荐答案

看看这段代码:

Have a look at this code:
<asp:button id="save" runat="server" text="Save" onclick="save_Click" onclientclick="return confirm('Are you sure you want to save selected records?');" />



如果您按此代码,此代码将要求您确认操作是的,那么只会执行save_Click。



:doh:




This code will ask you to confirm the action,if you press yes,then only save_Click will be executed.

:doh::

\\Do your calculations here







if(your condition1)
{  
  Response.Write("<script type='text/javascript'>");
  Response.Write("alert('This is alert1 if condition1 satisfied.');");
  Response.Write("</script>");
}
else
{
  Response.Write("<script type='text/javascript'>");
  Response.Write("alert('This is alert2 if condition1 does not satisfy.');");
  Response.Write("</script>");
}



问候..:)


Regards..:)


这篇关于如何在asp.net中显示弹出是/否消息框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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