in my web application i have taken a ajax calender in that i want to restrict the user to select future date, when user select future date should raise the error help me thank u.
+1
A:
Use compare validator and set its type to Date
<asp:CompareValidator ID="cmp" ControlToValidate="TextBox1" runat="server" ErrorMessage="CompareValidator"
Operator="LessThanEqual" Type="Date"></asp:CompareValidator>
In the codebehind set ValuetoCompare like.
if (!Page.IsPostBack)
{
cmp.ValueToCompare = DateTime.Today.ToShortDateString();
}
Muhammad Akhtar
2009-10-30 09:41:40
Thank u Mr.Muhammad Akhtar it is working
Surya sasidhar
2009-10-30 11:07:41
hello there, now if I want to add some more like whatever the date selected I want to add 7months and 2days with that and display it in another texbox..now how to do that? thanks you
Indranil Mutsuddy
2010-05-14 12:53:30