i have a calendar control whose value will be displayed in a textbox, i need to validate the textbox value to the current date... It should not be less than current date.....
Thanks for ur valuable reply for my last post
i have a calendar control whose value will be displayed in a textbox, i need to validate the textbox value to the current date... It should not be less than current date.....
Thanks for ur valuable reply for my last post
You can use the CompareValidator
control, like this:
<asp:CompareValidator ID="dateValidator"
ControlToValidate="IdOfTextBox"
Text="error message"
Operator="GreaterThanEqual"
Type="Date"
runat="server" />
And in the code-behind, set the ValueToCompare
property of the validator to DateTime.Today
(for example in the Page_Init
method).
Use CompareValidator control, set properties as below: operator = GreaterThanEqual Type = Date ValueToCompare = CurrentDate