2012-07-19 72 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

回答