Sometimes we want the date to be fixed between
two date. This can be done using range validator.
This code will be
on.aspx page
<asp:TextBox ID="txt_dob"
runat="server" class="form-control"
ReadOnly="True" placeholder="DOB" ></asp:TextBox>
<asp:CalendarExtender
ID="txt_dob_CalendarExtender" runat="server" TargetControlID="txt_dob">
</asp:CalendarExtender>
<asp:RangeValidator
ID="RangeValidator1"
runat="server"
ErrorMessage="Enter Valid Date"
Type="String"
ControlToValidate="txt_dob"
Display="Dynamic"
MaximumValue="12/20/2014"
MinimumValue="12/10/2010"
SetFocusOnError="True"
ValidationGroup="sub"
Operator="DataTypeCheck">
</asp:RangeValidator>
Summary
In this article I try to expose the range validator for date. I hope after reading this article you will be able to use this trick in your code. I would like to have feedback from my blog readers. Please post your feedback, question, or comments about this article.
No comments:
Post a Comment