javascript - 服务器端的 ASP.NET 确认对话框

标签 javascript asp.net

我有一个页面,它接受用户的输入,然后通过单击按钮处理他的请求。 在此按钮单击事件中,我需要验证他输入的输入,并在某些条件下显示确认对话框。 如果他单击"is",那么我需要执行进一步的操作,否则返回。

我尝试过使用

Page.ClientScript.RegisterStartupScript(this.GetType(), Constants.OpenConfirm, "confirm('Data Already Exists, do you Wish to Overwrite the existing record?')", true);

但无论我单击"is"还是“否”,它都会执行进一步的操作。

已尝试使用从服务器端调用 JavaScript 方法,但这也行不通。

最佳答案

您需要处理确认调用的结果。所以脚本参数必须是这样的:

if(!confirm('Data Already Exists, do you Wish to Overwrite the existing record?')) return false;

关于javascript - 服务器端的 ASP.NET 确认对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19399896/

相关文章:

JavaScript - 正则表达式

c# - JQuery Facebox 插件 : Get it inside the form tag

c# - Web.config 应用程序设置

asp.net - ValidateInput 属性似乎在 ASP.NET MVC 中不起作用

.net - ASP.NET 请求总是在同一个线程上进行 BeginRequest 和 EndRequest 吗?

javascript - 闭包如何帮助函数了解前一个函数调用的私有(private)变量

javascript - 完整日历: start calendar with a specific week

javascript - node js中的日期格式转换

javascript - xpages 文档默认设置为只读加载 - 有些以编辑模式加载

asp.net - 如何使按钮看起来像超链接 aspx.net