Solved

ASP.NET - Disabling validation control when textbox is dynamically hidden with Javascript

Posted on 2004-09-08
2
520 Views
Last Modified: 2010-05-18
I have a number of rows in a table for data input, such as:

      <tr class="orig" id="kid1" style="DISPLAY: none">
            <td>
                  <br />
                  <asp:TextBox id="txtF1" runat="server"></asp:TextBox>
                  <asp:RequiredFieldValidator id="RequiredFieldValidator1a" runat="server" ControlToValidate="txtF1">*</asp:RequiredFieldValidator>
                  <asp:TextBox id="txtL1" runat="server"></asp:TextBox>
                  <asp:RequiredFieldValidator id="RequiredFieldValidator1b" runat="server" ControlToValidate="txtL1">*</asp:RequiredFieldValidator>
            </td>
      </tr>

Then I'm using Javascript to set document.all.kid1.style.display="inline" or ="none" to show/hide different rows.

The problem is that even though a row is hidden the validator control is still enabled.  When I hide the row I can set the textboxes to some bogus value to fool the validator but is there any way to disable the validator in the first place?

Thanks for your help!  =)
0
Comment
Question by:welly1
2 Comments
 
LVL 36

Accepted Solution

by:
Zyloch earned 150 total points
ID: 12013310
Hi

Check this page: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspplusvalid.asp

Especially search for ValidatorEnable(val, enable) :)

Regards,
Zyloch
0
 

Author Comment

by:welly1
ID: 12022358
Fantastic Zyloch!

I know there had to be an easy way...

Thanks for your help!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question