Required Field Validator

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a TextControl and a RequiredFieldValidator attached to it.
How can I disable the validator if the TextControl is disabled?

Thank you.
 
Stupid solution is one but since nobody answers to you it is one valid
alternative.
Example TextBox

In the code

protected bool IsDisable ;

IsDisable == false ;
if (Textbox1.enabled == false)
{
IsDisable == true ;
}

In Html

<% if IsDisable == true { %>

<asp:regularexpressionvalidator id="RegularExpressionValidator1"
runat="server" ControlToValidate="Textbox1"
ErrorMessage=""ValidationExpression=""></asp:regularexpressionvalidator>

<%}%>
 
Hello Francesco,

Wow... What a complex solution...

Whats wrong with:

<asp:regularexpressionvalidator id="RegularExpressionValidator1"
runat="server" ControlToValidate="Textbox1"
ErrorMessage="ValidationExpression=" Enabled="<% Textbox1.Enabled %>"></asp:regularexpressionvalidator>
 
Back
Top