2

我怎样才能得到以下结果(无论是否点击):

单击按钮时:

//First I am checking validations
//Then I am checking if pay grade is being overridden from the business layer
//If it is overriden:
ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "confirm('You are overriding the existing pay grade. Do you want to Override ?');", true);
//If the user clicks Yes, more code to save new pay grade in the database is executed.
//Else nothing is done.

如果单击是,我想继续执行下面的代码,否则下面的代码不会执行

4

2 回答 2

0

您将在这里遇到的问题是服务器未连接到客户端。服务器不会停止处理并等待用户的响应,然后从这行代码恢复处理。您需要为此编写 JavaScript,然后根据响应向服务器发出回调。

于 2013-07-29T12:12:34.690 回答
0

在确认对话框之前添加返回

ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "return confirm('You are overriding the existing pay grade. Do you want to Override ?');", true);
于 2013-07-29T12:10:45.977 回答