How to validate dates in ASP.NET

The simpliest way is by using range validator control and define date bounds


<asp:textbox id="textbox1" runat="server">
</asp:textbox>
<asp:rangevalidator id="valRange" runat="server" controltovalidate="textbox1"
maximumvalue="31/12/2010"
minimumvalue="1/1/2000" type="Date"
errormessage="*" display="dynamic">
*
</asp:rangevalidator>

No comments:

Post a Comment