JQuery Datepicker 在代码隐藏中获取 selectedmonth 更改事件
JQuery Datepicker get selectedmonth change event in codebehind
我的页面上有一个 jquery-datepicker :
<div id="COICalendar" class="datepicker ll-skin-vigo"></div>
脚本如下所示:
$("#COICalendar").datepicker();
这样我总能看到完整的月份。
现在如何在我的代码隐藏文件中捕获 "onselectedmonthchange" 事件(如果存在)?
我需要这样做的原因是因为我想用几个日期来获得特定的颜色。这些日期来自数据库。
此外,我在同一页面上有几个日历,我希望当我更改其中一个日历上的月份时,它们都更改为同一个月。
您可以尝试使用 beforeShowDay
事件回调:
// css
.highlightedDate {
/* highlight styles */
}
// javascript
function paintDatepicker(specialDates) {
$("#" + dateFieldId).datepicker({
beforeShowDay : function(calDate) {
/* This callback function will be invoked before painting each
* date.
* Perform required business validations here and then check
* if the conditions are met.
* You may access 'specialDates' here.
*/
if (condition) {
return [true, "highlightedDate", calDate];
}
}
});
}
我的页面上有一个 jquery-datepicker :
<div id="COICalendar" class="datepicker ll-skin-vigo"></div>
脚本如下所示:
$("#COICalendar").datepicker();
这样我总能看到完整的月份。 现在如何在我的代码隐藏文件中捕获 "onselectedmonthchange" 事件(如果存在)?
我需要这样做的原因是因为我想用几个日期来获得特定的颜色。这些日期来自数据库。
此外,我在同一页面上有几个日历,我希望当我更改其中一个日历上的月份时,它们都更改为同一个月。
您可以尝试使用 beforeShowDay
事件回调:
// css
.highlightedDate {
/* highlight styles */
}
// javascript
function paintDatepicker(specialDates) {
$("#" + dateFieldId).datepicker({
beforeShowDay : function(calDate) {
/* This callback function will be invoked before painting each
* date.
* Perform required business validations here and then check
* if the conditions are met.
* You may access 'specialDates' here.
*/
if (condition) {
return [true, "highlightedDate", calDate];
}
}
});
}