From and To Date Validation
For validating the date use pop up calendar. So the User can easily select the date from calendar.
Steps of using popup calendar
Step 1 First Register Popup Calender on the top of of your aspx page.
<%@ Register Assembly="RJS.Web.WebControl.PopCalendar.Net.2008" Namespace="RJS.Web.WebControl"
TagPrefix="rjs" %>
Step 2 Use Calendar with your date text boxes.
<tr>
<td><asp:Label ID="Label6" runat="server" Text="Depart Date"</asp:Label></td>
<td><asp:TextBox ID="TextBox6" runat="server" Text=""></asp:TextBox>
<div style="margin-left: 130px; margin-top: -21px;">
<rjs:PopCalendar ID="calDepartureDateFrom" runat="server" Control="TextBox6"
From-Date="1950-01-01" Separator="/" Format="dd mm yyyy"
ShowErrorMessage="false" />
</div>
</td>
</tr>
<tr>
<td><asp:Label ID="Label7" runat="server" Text="Return Date"></asp:Label></td>
<td><asp:TextBox ID="TextBox7" runat="server" Text=""></asp:TextBox>
<div style="margin-left: 130px; margin-top: -21px;">
<rjs:PopCalendar ID="calReturnDateTo" runat="server"
Control="TextBox7" From-Date="" Separator="/" Format="dd mm yyyy"
ShowErrorMessage="false" From-Control="TextBox6" />
</div>
</td>
</tr>
Step 3 Set Departure Calendar Start Date to after Today(dissabling past dates). The Date can be set on the cs(Code behind) page on page load event.
protected void Page_Load(object sender, EventArgs e)
{
calDepartureDateFrom.StartDate = DateTime.Now+1;
}