I have some javascript to alter the functionality of a calendar extender control that I want to pass a parameter to (an ID) and the parameter never gets set. The function works when I hard code the parameter in the js file but I'm having trouble finding out why I can pass the parameter to the function.
Here is an example of the aspx code I'm using:
<ajax:CalendarExtender ID="clxStartMonth" runat="server" TargetControlID="txtStartMonth" Format="MM/yyyy" DefaultView="Months" ClientIDMode="Static" OnClientHidden="onCalendarHidden('clxStartMonth');" OnClientShown="onCalendarShown('clxStartMonth');" ></ajax:CalendarExtender>
As you can see I'm trying to pass the control ID to the functions triggered by the OnClientHidden and OnClientShown events.
Here are the javascript functions:
function onCalendarHidden(clx) {
var cal = $find(clx);
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 onCalendarShown(clx) {
var cal = $find(clx);
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 call(eventElement) {
var target = eventElement.target;
switch (target.mode) {
case "month":
var cal = $find("clxStartMonth");
cal._visibleDate = target.date;
cal.set_selectedDate(target.date);
cal._blur.post(true);
cal.raiseDateSelectionChanged();
break;
}
}
Any ideas as to what I can do to fix this issue?