I have an aspx calendar that works fine in IE, however, in FF, the date selection does not respond. When I put a breakpoint in the code behind (calActiveCal_SelectionChanged event), the application does not break into that function. So the function is not being called.
The HTML code is:
<td align="center" bgcolor="#ffffff" height="19">
<asp:Calendar ID="calActiveCal" runat="server" BackColor="White" BorderColor="Silver"
BorderStyle="Solid" CellPadding="1" CssClass="Calendar" ShowGridLines="True" OnSelectionChanged="calActiveCal_SelectionChanged">
<TodayDayStyle CssClass="CalToday" />
<SelectorStyle BackColor="#C0C0FF" CssClass="CalHRef" />
<DayStyle CssClass="CalDate" />
<NextPrevStyle CssClass="CalNavMonth" />
<DayHeaderStyle CssClass="CalDayHead" />
<SelectedDayStyle BackColor="Blue" CssClass="CalSelDay" />
<TitleStyle BackColor="#C0C0FF" CssClass="CalMonthHead" />
<WeekendDayStyle CssClass="CalWeekend" />
</asp:Calendar>
</td>
Update: When debugging in Firebug, I get an error message:
window.opener.document.forms is not a function
When I search for window.opener.document.forms its in the C# code behind:
string control = "txtDate";
if (this.calActiveCal.SelectedDate > DateTime.Now && !this.ShowFutureDates)
{
this.calActiveCal.SelectedDate = DateTime.Now;
}
if (Request.QueryString.Get("c") != null)
{
string setting = Request.QueryString.Get("c");
if (!setting.Equals(String.Empty))
{
control = setting;
}
}
string strScript = "<script>window.opener.document.forms(0)." + control + ".value = '";
strScript += calActiveCal.SelectedDate.ToString("MM/dd/yyyy");
strScript += "';self.close()";
strScript += "</" + "script>";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Calendar_ChangeDate", strScript);
The strScript value is (if user selected 12/30/2011) :
<script>window.opener.document.forms(0).txtFrom.value = '12/30/2011';self.close()</script>
Any ideas how to get this working in FF? Unfortunately, jQuery is not an option at the moment.
replace
forms(0)withforms[0]