根据确认对话框执行代码,单击确定 [英] Execute code based on Confirmation dialog ok click

查看:78
本文介绍了根据确认对话框执行代码,单击确定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在按钮单击事件中,将调用存储过程,如果存储过程返回失败代码,则应基于确认对话框恢复进一步的执行,用户可以在该对话框中恢复或退出执行.

这就是我要做的,如何实现这一目标...?

我无法使用页面方法,因为它们是静态的.

第1行
第2行
第3行
第4行
第5行
如果sp返回错误
Confirm();
如果(是)
恢复执行
其他
回滚

我可以处理回滚,但是如何在执行过程中实现此confrim对话框?

我需要拆分为例程吗???


感谢任何建议.

In button click event , stored procedure is called, if the stored procedure returns failure code, further execution should resume based on a confirm dialog where user can resume or quit the execution.

This is what I have to do , How can I achieve this...?

I can''t use page methods since they are static.

line 1
line 2
line 3
line 4
line 5
if sp returns error
confirm();
if(yes)
resume execution
else
rollback

I can deal with rollback , but how can i achieve this confrim dialog in the amidst of execution?

DO I need to split into routines?????


any suggestion is appreciated.

推荐答案




您可以使用ajax模态弹出窗口来显示确认弹出窗口.
然后,您可以在弹出窗口的确定"按钮单击和取消"按钮单击上编写代码.

希望对您有所帮助.
Hi,


You can use ajax modal popup to display the confirm popup.
You can then write your code on Ok button click and cancel button click of the popup.

Hope this helps.


您需要将其分为三部分.首先调用SP的一部分,一部分显示确认对话框,另一部分处理确认对话框的结果.

您可以使用ClientScriptManager显示对话框:

http://msdn.microsoft.com/en-us/library/btf44dc9.aspx [ ^ ]

在您注册的脚本中,您还可以放置用于处理对话框结果的代码:

http://www.w3schools.com/jsref/met_win_confirm.asp [使用JavaScript调用ASP.NET服务器端事件 [^ ]
You need to split this up into three parts. One part to call the SP in the first place, one part to show the confirm dialog and another to handle the result of the confirm dialog.

You can show the dialog using ClientScriptManager:

http://msdn.microsoft.com/en-us/library/btf44dc9.aspx[^]

In the script you register you can also put the code for handling the dialog result:

http://www.w3schools.com/jsref/met_win_confirm.asp[^]

Based on the result you can then use JavaScript to post to the page again, to either resume execution or perform the rollback:

Calling ASP.NET server-side events using JavaScript[^]


这篇关于根据确认对话框执行代码,单击确定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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