简体   繁体   English

确认是或否在ASP网络中的消息

[英]confirmation yes or no message in asp net

I have a problem to show confirm yes or no message box in asp.net. 我在显示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
}

Thanks 谢谢

You can create a confirm box in JavaScript by using: confirm() . 您可以使用以下方法在JavaScript中创建一个确认框: confirm()

You need to implement this code in your ASP.NET code. 您需要在ASP.NET代码中实现此代码。

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

Try with this script: 尝试使用以下脚本:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM