I have a CalendarExtender like this
<asp:TextBox ID="txb" runat="server" OnTextChanged="txb_TextChanged" AutoPostBack="true" CausesValidation="true" onchange="txbTextChanged()" />
<asp:CalendarExtender ID="cle" runat="server" Format="MMM, yyyy" TargetControlID="txb" OnClientHidden="onCalendarHidden" OnClientShown="onCalendarShown" BehaviorID="calendarTLMonth" DefaultView="Months" DaysModeTitleFormat="MMM, yyyy" />
The java script functions are:
function onCalendarShown() {
var cal = $find("calendarTLMonth");
cal._switchMode("months", true);
if (cal._monthsBody) {
for (var i = 0; i < cal._monthsBody.rows.length; i++) {
var row = cal._monthsBody.rows[i];
for (var j = 0; j < row.cells.length; j++) {
Sys.UI.DomEvent.addHandler(row.cells[j].firstChild, "click", call);
}
}
}
}
function onCalendarHidden() {
var cal = $find("calendarTLMonth");
if (cal._monthsBody) {
for (var i = 0; i < cal._monthsBody.rows.length; i++) {
var row = cal._monthsBody.rows[i];
for (var j = 0; j < row.cells.length; j++) {
Sys.UI.DomEvent.removeHandler(row.cells[j].firstChild, "click", call);
}
}
}
}
function call(eventElement) {
var target = eventElement.target;
switch (target.mode) {
case "month":
var cal = $find("calendarTLMonth");
cal._visibleDate = target.date;
cal.set_selectedDate(target.date);
cal._blur.post(true);
cal.raiseDateSelectionChanged();
break;
}
}
I want enable and disable months randomallicaly- not with startDate. For this, I need to know what is the date: month and year. Can I know in the onCalendarShown function, in both loops, i and j, before doing addHandler, what is the year?