Solved

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

Posted on 2004-09-08
2
513 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
Comment Utility
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
Comment Utility
Fantastic Zyloch!

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

Thanks for your help!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now