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 开发者_StackOverflowproperty, but the validations are still triggered.
How can I do this in c# / asp.net?
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
Set the OnClick attribute of the LinkButton to a method you create that disables the controls.
<asp:LinkButton runat="server" OnClick="btnLinkButton_Click"></asp:LinkButton>
and
protected void btnLinkButton_Click(object sender, EventArgs e)
{
    control1.Enabled = false;
    control2.Enabled = false;
}
mileage will vary when disabling your validation controls, but this would work if you were using the generic .NET validation controls.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论