Asp.net calendar date picker not responding in firefox

I have an aspx calendar that works fine in IE, however in FF the date picker is not responding. When I put a breakpoint in the code (calActiveCal_SelectionChanged event), the application does not break into this function. Therefore, the function is not called.

HTML code:

<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, an error message appears:

window.opener.document.forms is not a function

When I look for window.opener.document.forms it 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); 

StrScript value (if user selected 12/30/2011):
<script>window.opener.document.forms(0).txtFrom.value = '12/30/2011';self.close()</script>

Any ideas how to make this work in FF? Unfortunately, jQuery is currently not an option.

+4
source share
2 answers

replace forms(0) with forms[0]

+3
source

Perhaps you have client-side errors (javascript) that occur only in FF, and this prevents even sending the FF request that you expect from the server. Use Firebug to find out if something is being reported on the error console.

+3
source

Source: https://habr.com/ru/post/1393240/


All Articles