tags:

views:

26

answers:

2

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

+1  A: 

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).

Graham Clark
A: 

Use CompareValidator control, set properties as below: operator = GreaterThanEqual Type = Date ValueToCompare = CurrentDate

vinayak