确认是或否在ASP网络中的消息 [英] confirmation yes or no message in asp net

查看:856
本文介绍了确认是或否在ASP网络中的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在显示asp.net中的确认是或否消息框时遇到问题.

I have a problem to show confirm yes or no message box in asp.net.

string script = "alert(\"Insert success !!! \");";
    ScriptManager.RegisterClientScriptBlock(this, GetType(), "key", script, true); 

我可以显示消息框插入成功,但是我不知道如何确认消息框.此消息框,

I can display message box insert success but i dont know how to make confirm message box. this message box,

if choose yes
{
do something
}
else
{
do something
}

谢谢

推荐答案

您可以使用以下代码在JavaScript中创建一个确认框: confirm().

You can create a confirm box in JavaScript by using: confirm().

您需要在ASP.NET代码中实现此代码.

You need to implement this code in your ASP.NET code.

if (confirm("Are you sure?")) {
  alert("OK");
} else {
  alert("BAD");
}

尝试使用此脚本:

string script = "if(confirm(\"Are you sure?\")){ alert(\"OK\");} else { alert(\"BAD\");}";
ScriptManager.RegisterClientScriptBlock(this, GetType(), "key", script, true); 

这篇关于确认是或否在ASP网络中的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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