Hi,
I use one dropdownlist and 2 textboxes for enter DOB in registration page. Now,I have problem when selecting February month. I have to check the year field(the year entered by user is leap year or not) and then according this I control user the last date of February.Can anyone help me to do this?How I control user from entering the last date of february based on year? My code is following:
<tr>
<td align="left">
<font color="black"><b>Date Of Birth</b></font><font color="red">*</font>
</td>
<td align="left">
<asp:DropDownList ID="ddlMonth" runat="server" TabIndex="12">
<asp:ListItem Text="January" Value="1"></asp:ListItem>
<asp:ListItem Text="February" Value="2"></asp:ListItem>
<asp:ListItem Text="March" Value="3"></asp:ListItem>
<asp:ListItem Text="April" Value="4"></asp:ListItem>
<asp:ListItem Text="May" Value="5"></asp:ListItem>
<asp:ListItem Text="June" Value="6"></asp:ListItem>
<asp:ListItem Text="July" Value="7"></asp:ListItem>
<asp:ListItem Text="August" Value="8"></asp:ListItem>
<asp:ListItem Text="September" Value="9"></asp:ListItem>
<asp:ListItem Text="October" Value="10"></asp:ListItem>
<asp:ListItem Text="November" Value="11"></asp:ListItem>
<asp:ListItem Text="December" Value="12"></asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="txtDateOfBirth" runat="server" TabIndex="13" Width="6%" MaxLength="2"
onfocus="disableautocompletion(this.id);" AutoCompleteType="Disabled"></asp:TextBox>
<asp:TextBox ID="txtBDayYear" runat="server" TabIndex="14" Width="8%" MaxLength="4"
onfocus="disableautocompletion(this.id);" AutoCompleteType="Disabled"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Enter valid year"
ForeColor="Red" ControlToValidate="txtBDayYear" ValidationExpression="^[0-9]{4}$"></asp:RegularExpressionValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtDateOfBirth"
ErrorMessage="Enter the Date" ValidationGroup="TabGroup1" ForeColor="Red"></asp:RequiredFieldValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtBDayYear"
ErrorMessage="Enter the Year" ValidationGroup="TabGroup1" ForeColor="Red"></asp:RequiredFieldValidator>
<asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtdateofbirth" Type="Integer"
MinimumValue="1" MaximumValue="31" ErrorMessage="Please Enter Valid Date" ValidationGroup="TabGroup1"
ForeColor="Red"></asp:RangeValidator>
<asp:RangeValidator ID="RangeValidator2" runat="server" ControlToValidate="txtbdayyear"
MinimumValue="1900" MaximumValue="2013" ErrorMessage="Please Enter Valid Year"
ValidationGroup="TabGroup1" ForeColor="Red"></asp:RangeValidator>
<asp:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="txtDateOfBirth"
FilterType="Numbers" Enabled="True">
</asp:FilteredTextBoxExtender>
<asp:FilteredTextBoxExtender ID="FilteredTextBoxExtender5" runat="server" TargetControlID="txtBDayYear"
FilterType="Numbers" Enabled="True">
</asp:FilteredTextBoxExtender>
</td>
</tr>