在单击“取消"按钮时停止JS警报 [英] Stop JS alerts on CANCEL button click

查看:76
本文介绍了在单击“取消"按钮时停止JS警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个带有可编辑文本框的GridView.我检查textbox(检查为空)onblur事件的值.效果很好.

但是我需要的是,当我单击取消"按钮时,它再次调用我的脚本警报".

如何禁用取消"按钮上的那些警报单击? >
甚至当我单击取消"按钮时,引起警报和使焦点始终会重复.因此,我只是停止了JS发出的警报.

因此,它仅专注于文本框.当我单击取消"时,它再次聚焦一次并执行取消"服务器代码.在取消事件的代码中,我失去了页面焦点(response.redirect("URL")).因此,它工作正常.


谢谢大家的支持...


将按钮的EnableValidation属性设置为false


CausesValidation属性确定是否必须在单击按钮时执行验证是否使用asp.net验证控件.可以为true或false.默认情况下为true.

为了防止单击取消"按钮时发生验证,请将CausesValidation属性设置为false

< asp:Button ID = "  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.net 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警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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