使用LinkButton时禁用验证控件(Disabling validation controls when using a LinkButton)

编程入门 行业动态 更新时间:2024-10-27 21:14:17
使用LinkButton时禁用验证控件(Disabling validation controls when using a LinkButton)

我正在使用LinkBut​​ton来触发电子邮件模板。 当单击LinkBut​​ton时,我需要禁用所有字段验证控件

我尝试了Causesvalidation属性,但验证仍然被触发。

我怎么能在c#/ asp.net中做到这一点?

I am using a LinkButton to trigger an email template. When the LinkButton is clicked, I need to disable all field validation controls

I tried the causesvalidation property, but the validations are still triggered.

How can I do this in c# / asp.net?

最满意答案

好吧,我不认为你需要禁用验证控件。 我假设你在页面上有另一个按钮来触发所有的验证,但你只是想跳过这个按钮。

在LinkBut​​ton上使用CauseValidation = false

<asp:LinkButton id="LinkButton1" runat="server" Text="Generate Template" CausesValidation="False"> </asp:LinkButton >

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.causesvalidation%28VS.80%29.aspx

Well, I don't think you need to disable the validations controls. I assume that you have another button on the page that fires all validation but you just want to skip them for this button.

Use CauseValidation = false on your LinkButton

<asp:LinkButton id="LinkButton1" runat="server" Text="Generate Template" CausesValidation="False"> </asp:LinkButton >

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.causesvalidation%28VS.80%29.aspx

更多推荐

本文发布于:2023-07-17 07:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1141315.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控件   LinkButton   Disabling   controls   validation

发布评论

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

>www.elefans.com

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