在web应用确认消息框 [英] Confirmation message box in webapplication

查看:108
本文介绍了在web应用确认消息框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正在使用asp.net web应用程序下面的消息框。现在,我想这个消息框转换为确认消息框,并做一些事情,当它是真的别的手段驳回申请。

  ScriptManager.RegisterStartupScript(这一点,this.GetType(),温度,< SCRIPT LANGUAGE =JavaScript的'>警报('你确定,你要申请?');< / SCRIPT>中,FALSE);


解决方案

我想你会对此错误的方式。你应该显示这个确认的之前回发,然后只如果他们选择应用后回来。

使用ASP.NET Web控件,在按钮控制有一个<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.onclientclick.aspx\"><$c$c>OnClientClick它可以用来调用JavaScript属性之前,HTTP POST:

您可以做这样的事情:

 &LT; ASP:按钮的ID =BTN。
            =服务器
            文本=应用
            的OnClientClick =返回确认(你确定要申请吗?');
            的OnClick =btn_Click/&GT;

Am using the below message box in asp.net web application. Now i want to convert this message box as a confirmation message box and do something when it is true else means reject the application.

   ScriptManager.RegisterStartupScript(this, this.GetType(), "temp", "<script language='javascript'>alert('Are you sure, you want to apply?');</script>", false);

解决方案

I think you are going about this the wrong way. You should display this confirmation before posting back, and then only post back if they choose to "Apply".

Using ASP.NET web controls, the Button control has an OnClientClick property which can be used to call javascript prior to Http POST:

You could do something like this:

<asp:button id="btn"
            runat="server"
            Text="Apply"
            OnClientClick="return confirm('Are you sure you wish to apply?');"
            OnClick="btn_Click" />

这篇关于在web应用确认消息框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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