Basically, I just want allow select dates greater than today. I'd prefer this way to avoid show alert messages.
相关问题
- Carriage Return (ASCII chr 13) is missing from tex
- How to store image outside of the website's ro
- 'System.Threading.ThreadAbortException' in
- Request.PathInfo issues and XSS attacks
- How to dynamically load partial view Via jquery aj
相关文章
- asp.net HiddenField控件扩展问题
- asp.net HiddenField控件扩展问题
- Asp.Net网站无法写入错误日志,测试站点可以,正是站点不行
- asp.net mvc 重定向到vue hash字符串丢失
- FormsAuthenticationTicket expires too soon
- “Dynamic operations can only be performed in homog
- What is the best way to create a lock from a web a
- Add to htmlAttributes for custom ActionLink helper
set StartDate property of the calender extender to DateTime.Now.Date in the page load this will show the previous dates as unselectable
I don't think that it is supported in the current version of the Toolkit to restrict selectable dates. This is a simple workaround handling the
ClientDateSelectedChanged
-Event and validate the selected date:There could be instances where you do not want the user to select a day earlier than the current date. For example: when you are providing the user a form to book tickets, you would not like him to choose an earlier date. To achieve this requirement, use the following javascript code.
Call the code:
In the javascript, just change this line
sender._selectedDate > new Date()
Note: You may argue that the user can still change the date by typing into the textbox or entering an invalid date. Well that can be easily handled using a ValidationControl and is covered in the next tip.A simple way to add validation to the Calendar is to add a ValidationControl to the textbox associated with a CalendarExtender. You have two choices:
Extender
to theValidationControl
. To do so, drag and drop aValidationControl
> click on the smart tag of theValidationControl
> chooseAdd Extender
. From the Extender Wizard, chooseValidatorCalloutExtender
. Using this approach makes it extremely easy to discover and attach control extenders to your controls. In VS 2005, you had to do this process manually, by wiring up control extenders.ValidationControls
to theTextBox
. The first, aCompareValidator
to check if the user does not enter an invalid date (Eg: May 32) and second, aRangeValidator
to keep the date range as desired.Adding CompareValidator
In the code behind of your page, add this code C#
VB.NET
Well those were some tips associated with the
CalendarExtender
. As future versions of the toolkit are released, we should be hopeful that there will exist easier ways, of achieving this functionality.From: http://www.dotnetcurry.com/ShowArticle.aspx?ID=149
Another advanced approach would be to extend the CalendarExtender javascript, but then you have your own custom version of the ajax toolkit.
http://codegoeshere.blogspot.com/2007/06/extending-calendarextender.html