开发者

Bound ajax calendar extender to specific month and year only

I have two calendar extender, Which I want to restrict. When user selects any year from year drowdown list and month from month dropdown list, the calendar extender should show dates for selected month and year only and use is not allowed to selected any other month and year from the calendar extender. For eg. If I select year=2011 and month = September from year and month drop down lists respectively, then both the calendar extenders should show date for September-2011 + 1st October开发者_如何学C and I should be allowed to selected date form these dates only and selection of any other date is not allowed.I dont want to use Jquery.


I believe you may use following approach (fast and quite dirty): add script and style below onto the page:

<style type="text/css" >
     div.ajax__calendar_prev,
     div.ajax__calendar_next,
     div.ajax__calendar_today
     {
          display: none !important;
     }
</style>
<script type="text/javascript">
     function pageLoad() {
          var extender = $find("calendarExtenderBehaviorID");
          extender._switchMode = function () { };
     }
</script>

This will prohibit calendar mode switching and hide elements that may be used for changing month and year.

Also you need a RangeValidator attached to target textbox for checking selected date value. In dropdown's selected index changed event handler you need to set calendar extender selected date and set range validator's minimum and maximum values in accordance with selected year and month.

As an alternative you can use CustomValidator and perform all checks and assignments in javascript.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜