Avatar of lakhi
lakhi
 asked on

Conditional validation in asp.net DetailsView

I have a DetailsView I'm using to have users enter data. A couple of the fields have two validators. For example, a required field that also needs to be in a certain format. I don't want to show two error messages for one field.
I'm pretty sure this could be handled in the code behind but I'm not quit sure how to do it. (Sorry if it's messy, I wasn't sure how to include code in the message)
Here is an example of one of the fields I'm talking about
            <InsertItemTemplate>
              <asp:TextBox ID="jobNoTextBox" runat="server"
                  Text='<%# Bind("jobNo") %>' SkinID="TBInsert" MaxLength="7"          width="144px/>
              <asp:RequiredFieldValidator ID="jobNoRequiredFieldValidator" runat="server" ControlToValidate="jobNoTextBox" Display="dynamic"
                ErrorMessage="Job No is required" Width="112px"></asp:RequiredFieldValidator>
              <asp:CustomValidator ID="jobNoCustomValidator" runat="server" ClientValidationFunction="Min7Length" ControlToValidate="jobNoTextBox" Display="Dynamic" ErrorMessage="Job No is 7 characters in this format: 9999.99"
                Width="264px"></asp:CustomValidator>
            </InsertItemTemplate>

Thanks for any help on this
ASP.NET

Avatar of undefined
Last Comment
lakhi

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Anurag Thakur

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
lakhi

ASKER
Thanks!
Your help has saved me hundreds of hours of internet surfing.
fblack61