Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6810755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:14:38+00:00 2026-05-26T20:14:38+00:00

I’m trying to implement validation in my ASP.NET Webforms application. Right now, the only

  • 0

I’m trying to implement validation in my ASP.NET Webforms application. Right now, the only validator that works is for the Date of Birth (DOB) field. It is a custom field.

ASPX Code

<table>

      <tr> <td align="center" colspan="2"> 
      <asp:Label ID="RegisterTitleID" runat="server">Register here for your New Account </asp:Label></td>
      </tr>

      <tr> 
      <td align="right"> <asp:Label ID="EmailLabel" runat="server" AssociatedControlID="EmailTextBox">E-mail:</asp:Label> </td>
      <td> <asp:TextBox ID="EmailTextBox" runat="server" Height="25px" Width="200px" 
              CausesValidation="True"></asp:TextBox></td>
           <asp:RequiredFieldValidator ID="EmailRequired" runat="server" 
            ControlToValidate="EmailTextBox" ErrorMessage="E-mail is required." 
            ToolTip="E-mail is required." ValidationGroup="RegistrationWizard" 
              Display="Dynamic">*</asp:RequiredFieldValidator> </tr>

      <tr> 
      <td align="right"> <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="PasswordTextBox">Password:</asp:Label> </td>
      <td> <asp:TextBox ID="PasswordTextBox" runat="server" TextMode="Password" 
              Height="25px" Width="200px" CausesValidation="True"></asp:TextBox></td> 
           <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" 
            ControlToValidate="PasswordTextBox" ErrorMessage="Password is required." 
            ToolTip="Password is required." ValidationGroup="RegistrationWizard" 
              Display="Dynamic">*</asp:RequiredFieldValidator> </tr>

      <tr>
      <td align="right"> <asp:Label ID="ConfirmPasswordLabel" runat="server" AssociatedControlID="ConfirmPasswordTextBox">Confirm Password:</asp:Label> </td>
      <td> <asp:TextBox ID="ConfirmPasswordTextBox" runat="server" TextMode="Password" Height="25px" Width="200px"></asp:TextBox></td>
           <asp:RequiredFieldValidator ID="ConfirmPasswordRequired" runat="server" 
            ControlToValidate="ConfirmPasswordTextBox" ErrorMessage="Confirm Password is required." 
            ToolTip="Confirm Password is required." ValidationGroup="RegistrationWizard">*</asp:RequiredFieldValidator> </tr>
      
      <tr> 
      <td align="center" colspan="2"> 
      <asp:CompareValidator ID="PasswordCompare" runat="server" 
            ControlToCompare="PasswordTextBox" ControlToValidate="ConfirmPasswordTextBox" 
            Display="Dynamic" 
            ErrorMessage="The Password and Confirmation Password must match." 
            ValidationGroup="RegistrationWizard"> </asp:CompareValidator> </td> </tr>

      <tr> 
      <td align="right"> <asp:Label ID="TitleLabel" runat="server" AssociatedControlID="TitleTextBox">Title:</asp:Label> </td>
      <td> <asp:TextBox ID="TitleTextBox" runat="server" Height="25px" Width="200px"></asp:TextBox></td>
           <asp:RequiredFieldValidator ID="TitleRequired" runat="server" 
            ControlToValidate="TitleTextBox" ErrorMessage="Title is required." 
            ToolTip="Title is required." ValidationGroup="RegistrationWizard">*</asp:RequiredFieldValidator> </tr>

      <tr> 
      <td align="right"> <asp:Label ID="FirstNameLabel" runat="server" AssociatedControlID="FirstNameTextBox">First Name:</asp:Label> </td>
      <td> <asp:TextBox ID="FirstNameTextBox" runat="server" Height="25px" Width="200px"></asp:TextBox></td>
           <asp:RequiredFieldValidator ID="FirstNameRequired" runat="server" 
            ControlToValidate="FirstNameTextBox" ErrorMessage="First Name is required." 
            ToolTip="First Name is required." ValidationGroup="RegistrationWizard">*</asp:RequiredFieldValidator> </tr>

      <tr> 
      <td align="right"> <asp:Label ID="SurnameLabel" runat="server" AssociatedControlID="SurnameTextBox">Surname:</asp:Label> </td>
      <td> <asp:TextBox ID="SurnameTextBox" runat="server" Height="25px" Width="200px"></asp:TextBox></td>
           <asp:RequiredFieldValidator ID="SurnameRequired" runat="server" 
            ControlToValidate="SurnameTextBox" ErrorMessage="Surname is required." 
            ToolTip="Surname is required." ValidationGroup="RegistrationWizard">*</asp:RequiredFieldValidator> </tr>

      <tr> 
      <td align="right"> <asp:Label ID="DOBLabel" runat="server" AssociatedControlID="DOBTextBox">Date of Birth:</asp:Label> </td>
      <td> <asp:TextBox ID="DOBTextBox" runat="server" Height="25px" Width="200px">dd/mm/yyyy</asp:TextBox>
          </td>
           <asp:RequiredFieldValidator ID="DOBRequired" runat="server" 
            ControlToValidate="DOBTextBox" ErrorMessage="Date of birth is required." 
            ToolTip="Date of birth is required." ValidationGroup="RegistrationWizard">*</asp:RequiredFieldValidator> 
           <asp:CustomValidator runat="server"
            ID="DateRangeCustomValidator" 
            ControlToValidate="DOBTextBox"
            onservervalidate="valDateRange_ServerValidate" 
            ErrorMessage="Enter a valid date. " />
            </tr>

      <tr> 
      <td align="right"> <asp:Label ID="GenderLabel" runat="server" AssociatedControlID="GenderDropDownList">Gender:</asp:Label> </td>
      <td> <asp:DropDownList ID="GenderDropDownList" runat="server" AppendDataBoundItems="true" Height="27px" Width="205px">
                <asp:ListItem Value="-1">Select</asp:ListItem>
                <asp:ListItem>Male</asp:ListItem>
                <asp:ListItem>Female</asp:ListItem>
                </asp:DropDownList> </td>

           <asp:RequiredFieldValidator ID="GenderRequired" runat="server" 
            ControlToValidate="GenderDropDownList" ErrorMessage="Gender is required." 
            ToolTip="Gender is required." ValidationGroup="RegistrationWizard">*</asp:RequiredFieldValidator> 
            </tr>

      <tr> 
      <td align="right"> <asp:Label ID="PhoneNumberLabel" runat="server" AssociatedControlID="PhoneNumberTextBox">PhoneNumber:</asp:Label> </td>
      <td> <asp:TextBox ID="PhoneNumberTextBox" runat="server" Height="25px" Width="200px"></asp:TextBox></td></tr>

      <tr> 
      <td align="right"> <asp:Label ID="FavouriteTeamLabel" runat="server" AssociatedControlID="FavouriteTeamDropDownList">Favourite Team:</asp:Label> </td>
      <td> 
          <asp:DropDownList ID="FavouriteTeamDropDownList" runat="server" DataSourceID="Team" 
              DataTextField="Team" DataValueField="Team" Height="27px" Width="205px">
          </asp:DropDownList>
          <asp:SqlDataSource ID="Team" runat="server" 
              ConnectionString="<%$ ConnectionStrings:RocoSportsDBConnectionString %>" 
              SelectCommand="SELECT [Team] FROM [Team]"></asp:SqlDataSource>
          </td>
      </tr>

      <tr> 
      <td align="right"> <asp:Label ID="MaritialStatusLabel" runat="server" AssociatedControlID="MaritialStatusDropDownList">Maritial Status:</asp:Label> </td>
      <td> <asp:DropDownList ID="MaritialStatusDropDownList" runat="server" AppendDataBoundItems="true" Height="27px" Width="205px">
                <asp:ListItem Value="-1">Select</asp:ListItem>
                <asp:ListItem>Single</asp:ListItem>
                <asp:ListItem>Married</asp:ListItem>
                <asp:ListItem>Separated</asp:ListItem>
                <asp:ListItem>Unmarried Relationship</asp:ListItem>
                <asp:ListItem>Domestic Partnership</asp:ListItem>
                </asp:DropDownList> </td>
            </tr>

      <tr> 
      <td align="right"> <asp:Label ID="EducationLabel" runat="server" AssociatedControlID="EducationDropDownList">Education:</asp:Label> </td>
      <td> <asp:DropDownList ID="EducationDropDownList" runat="server" AppendDataBoundItems="true" Height="27px" Width="205px">
                <asp:ListItem Value="-1">Select</asp:ListItem>
                <asp:ListItem>None</asp:ListItem>
                <asp:ListItem>Primary School</asp:ListItem>
                <asp:ListItem>Secondary School</asp:ListItem>
                <asp:ListItem>College</asp:ListItem>
                <asp:ListItem>Undergrad</asp:ListItem>
                <asp:ListItem>Postgrad</asp:ListItem>
                </asp:DropDownList> </td>
            </tr>

      <tr> 
      <td align="right"> <asp:Label ID="ProfessionLabel" runat="server" AssociatedControlID="ProfessionDropDownList">Profession:</asp:Label> </td>
      <td> <asp:DropDownList ID="ProfessionDropDownList" runat="server" AppendDataBoundItems="true" Height="27px" Width="205px">
                <asp:ListItem Value="-1">Select</asp:ListItem>
                <asp:ListItem>None</asp:ListItem>
                <asp:ListItem>Management</asp:ListItem>
                <asp:ListItem>Professional</asp:ListItem>
                <asp:ListItem>Armed Forces</asp:ListItem>
                <asp:ListItem>Sales</asp:ListItem>
                <asp:ListItem>Adminstrative</asp:ListItem>
                <asp:ListItem>Farming</asp:ListItem>
                <asp:ListItem>Construction</asp:ListItem>
                </asp:DropDownList> </td>
            </tr>

      <tr> 
      <td align="right"> <asp:Label ID="SalaryLabel" runat="server" AssociatedControlID="SalaryDropDownList">Salary:</asp:Label> </td>
      <td> <asp:DropDownList ID="SalaryDropDownList" runat="server" AppendDataBoundItems="true" Height="27px" Width="205px">
                <asp:ListItem Value="-1">Select</asp:ListItem>
                <asp:ListItem>None</asp:ListItem>
                <asp:ListItem>5000</asp:ListItem>
                <asp:ListItem>10000</asp:ListItem>
                <asp:ListItem>20000</asp:ListItem>
                <asp:ListItem>30000</asp:ListItem>
                <asp:ListItem>50000</asp:ListItem>
                <asp:ListItem>100000</asp:ListItem>
                </asp:DropDownList> </td>
            </tr>

      <tr> 
      <td align="right"> <asp:Label ID="EmploymentStatusLabel" runat="server" AssociatedControlID="EmploymentStatusDropDownList">EmploymentStatus:</asp:Label> </td>
      <td> <asp:DropDownList ID="EmploymentStatusDropDownList" runat="server" AppendDataBoundItems="true" Height="27px" Width="205px">
                <asp:ListItem Value="-1">Select</asp:ListItem>
                <asp:ListItem>Unemployed</asp:ListItem>
                <asp:ListItem>Employed</asp:ListItem>
                <asp:ListItem>Self-employed</asp:ListItem>
                <asp:ListItem>Volunteer</asp:ListItem>
                </asp:DropDownList> </td>
            </tr>
    <tr> 
      <td align="right"> <asp:Label ID="InterestsLabel" runat="server" AssociatedControlID="InterestsCheckBox">Interests:</asp:Label> </td>
      <td>
          <asp:CheckBoxList ID="InterestsCheckBox" runat="server" 
              onselectedindexchanged="InterestsCheckBox_SelectedIndexChanged">
              <asp:ListItem>Reading</asp:ListItem>
              <asp:ListItem>Football</asp:ListItem>
              <asp:ListItem>Swimming</asp:ListItem>
              <asp:ListItem>Basketball</asp:ListItem>
              <asp:ListItem>Cooking</asp:ListItem>
              <asp:ListItem>Music</asp:ListItem>
              <asp:ListItem>Philosophy</asp:ListItem>
              <asp:ListItem>Programming</asp:ListItem>
          </asp:CheckBoxList>
        </td>
    </tr>
   

      <tr> <td align="center" colspan="2" style="color:Red;"> <asp:Literal ID="ErrorMessage" runat="server" EnableViewState="False"></asp:Literal>  </td> </tr>
      <tr> <td align="center" colspan="2"> <asp:Button ID="RegisterButton" runat="server" Text="Register" onclick="registerbutton_Click"/> </td> </tr>
      </table>

What could be the problem that’s causing this code not to work, yet is not throwing any errors? Also, I’d like to position the validators better, and add color to them?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:14:39+00:00Added an answer on May 26, 2026 at 8:14 pm

    You are using a ValidationGroup for all your validators except the DOB Custom validator.

    Add it to your custom validator and also the Register Button.

    <asp:CustomValidator runat="server"
                    ID="DateRangeCustomValidator" 
                    ControlToValidate="DOBTextBox"
                    onservervalidate="valDateRange_ServerValidate" 
                    ErrorMessage="Enter a valid date. " 
            ValidationGroup="RegistrationWizard"/>
    
    
    <asp:Button ID="RegisterButton" runat="server" Text="Register"
     ValidationGroup="RegistrationWizard" onclick="registerbutton_Click"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.