我是asp.net/C#的新手.我正在尝试创建一个Web应用程序.
以下是我的要求.
我想在按钮点击上保存记录.在保存记录之前,我将检查数据库中是否存在该记录(在后面的代码中).如果它存在,那么我需要向用户显示一条警告"记录已经存在.你要继续吗? ?"当用户按'是'时,我需要继续保存代码中的记录,否则我只需要退出保存过程.
//......code for checking the existence of the record
if (check == true)
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", " confirm('Record already exist.Do you want to proceed?');", true);
}
//
Run Code Online (Sandbox Code Playgroud)
上面的代码显示了确认框,其中包含"确定"和"取消"按钮.我的问题是
我已经搜索了很多.但是得不到合适的答案.请帮我解决这个问题.
您可以查看此链接http://www.codeproject.com/Articles/8173/A-Simple-ASP-NET-Server-Control-Message-Box-Confir。
此外,您还可以创建自己的自定义确认框。