在单击“取消"按钮时停止JS警报

编程入门 行业动态 更新时间:2024-10-08 20:37:31
本文介绍了在单击“取消"按钮时停止JS警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个带有可编辑文本框的GridView.我检查textbox(检查为空)onblur事件的值.效果很好. 但是我需要的是,当我单击取消"按钮时,它再次调用我的脚本警报". 如何禁用取消"按钮上的那些警报单击? > 甚至当我单击取消"按钮时,引起警报和使焦点始终会重复.因此,我只是停止了JS发出的警报. 因此,它仅专注于文本框.当我单击取消"时,它再次聚焦一次并执行取消"服务器代码.在取消事件的代码中,我失去了页面焦点(response.redirect("URL")).因此,它工作正常. 谢谢大家的支持...

将按钮的EnableValidation属性设置为false

CausesValidation属性确定是否必须在单击按钮时执行验证是否使用asp验证控件.可以为true或false.默认情况下为true. 为了防止单击取消"按钮时发生验证,请将CausesValidation属性设置为false

< asp:Button ID = " btnCancel" runat = " 服务器" CausesValidation = " 否" Text = " 取消"/>

让我知道您的反馈意见.

hi, I have an GridView with Editable Textboxes. I check values of textbox(Check empty) onblur events. Its works fine. But what i need is, when i click CANCEL button, it again calls my "Script Alert". How to disable those alerts on CANCEL button Click??

解决方案

Found one Pretty solution for this Post, it may be not acceptable but its enough for me. Causing alert and make focus always repeates when even i click CANCEL button. Hence i just stops my alert from JS. So, its just focusing on the textbox. While i clicking CANCEL, it again focus once and execute the CANCEL server code. In CANCEL event''s code i lost my page focus(response.redirect("URL")). Hence it works fine. Thanks guys for your support...

Set the EnableValidation property of the button to false

CausesValidation property determines whether validation must be performed on button click or not, if asp validation control are used. It can be either true or false. By default it is true. To prevent validation to occur on the click of the Cancel button, set the CausesValidation property to false

<asp:Button ID="btnCancel" runat="server" CausesValidation="false" Text="Cancel" />

Let me know your feedback.

更多推荐

在单击“取消"按钮时停止JS警报

本文发布于:2023-11-28 01:06:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1640359.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:警报   单击   按钮   quot   JS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!