I use a textbox and get the selected date from calendar. After that I use a range validator like this
Calendar1.SelectionMode = CalendarSelectionMode.Day
Calendar1.SelectedDate = Date.Today
rvDate.ControlToValidate = "txtValidate"
rvDate.Type = ValidationDataType.Date
rvDate.MinimumValue = DateTime.Now.ToShortDateString()
rvDate.MaximumValue = ((Date.Today).AddDays(7)).ToShortDateString()
rvDate.ErrorMessage = "Select date between today to next 7 day!"
During run time, I got error like this
System.Web.HttpException: The value '26-Jul-12' of the MaximumValue property of 'rvDate' cannot be converted to type 'Date'.
How can I solve this problem?