确认消息的结果为假 [英] result of confirm message is false

查看:57
本文介绍了确认消息的结果为假的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码是-

My code is -

ScriptManager.RegisterStartupScript(upMB, this.GetType(), "script", "confirm('Are you proceed!');", true)


这可以正常工作并显示确认消息.
我的问题是,如果确认消息的结果为true,那么我想执行一些代码,如果确认消息的结果为false,我不希望代码执行.

但是目前无论哪种情况,代码都可以执行.

谁能帮帮我.


This works fine and displays confirm message.
My problem is, if the result of the confirm message is true, then I want to execute some code and if the result of confirm message is false I don''t want the code to execute.

But at present in either case the code gets executed.

Can anyone help me out please.

推荐答案


您必须从事件处理程序中的函数返回值:

Hi,
You have to return the value from the function in the event handler:

OnClientClick="return ConfirmDelete();"



顺便说一句,您不需要函数中的所有逻辑,只需从Confirm调用返回结果即可:



By the way, you don''t need all that logic in the function, just return the result from the confirm call:

function ConfirmDelete() {
  return confirm("Are you SURE you want to delete this item?");
};





--Amit





--Amit


检查这些-
confirmation-box-from-server-side-in-asp-net [^ ]
user-confirmation-from-code-后面 [
Check these -
confirmation-box-from-server-side-in-asp-net[^]
user-confirmation-from-code-behind[^]


这篇关于确认消息的结果为假的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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