2012-07-19 87 views
0

我使用一个文本框并从日历中获取所选日期。 之后,我使用了一系列验证这样asp.net日历验证

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!" 

在运行时,我得到了这样的

System.Web.HttpException: The value '26-Jul-12' of the MaximumValue property of 'rvDate' cannot be converted to type 'Date'. 错误我怎样才能解决这个问题?

+0

你的web.config文件中有标记吗? – aquinas 2012-07-19 03:54:59

回答