Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET UpdatePanel not working with Firefox
    primarykey
    data
    text
    <p>I'm trying to do something that sounds fairly simple using ASP.NET 3.5. A user should be able to add a "Community" to the database, and upon checking a box, pick a Parent Community from a DropDown menu that shows only if the check box is checked. For this I used a Panel (initially set to Visible=false) inside an UpdatePanel. My problem is that while it works in IE8 and Chrome (although Chrome reloads the whole page instead of just the div), in Firefox nothing happens. No query is sent <em>at all</em>. I should mention that all the code below is in a User Control page, not just a Web Form.</p> <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CommunityEditing.ascx.cs" Inherits="Folke.Code.Element.CommunityEditing" %&gt; &lt;asp:ScriptManager ID="ScriptManager1" runat="server" /&gt; &lt;div class="content"&gt; &lt;asp:Label id="editingFeedback" runat="server" /&gt; &lt;dl&gt; &lt;dt&gt;&lt;%=Folke.Code.Texte.L("Name") %&gt;&lt;/dt&gt;&lt;dd&gt;&lt;asp:TextBox ID="name" runat="server" /&gt;&lt;br /&gt; &lt;asp:RequiredFieldValidator ID="nameReq" runat="server" ControlToValidate="name" ErrorMessage="Community name is required!" /&gt;&lt;br /&gt; &lt;/dd&gt; &lt;/dl&gt; &lt;asp:CheckBox ID="cbToggle" runat="server" OnCheckedChanged="TogglePanel" Text="Has a parent community" AutoPostBack="True" /&gt; &lt;asp:UpdatePanel ID="parentCommunityUpdatePanel" runat="server" UpdateMode="Conditional"&gt; &lt;ContentTemplate&gt; &lt;asp:Panel id="parentCommunityPanel" runat="server" Visible="false"&gt; &lt;asp:DropDownList ID="communityListDropDownList" runat="server"/&gt; &lt;/asp:Panel&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:PostBackTrigger ControlID="cbToggle" /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; &lt;asp:Button runat="server" Text="Add" ID="send" onclick="send_Click" /&gt; &lt;/div&gt; </code></pre> <p>The code-behind code is as simple as it gets:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Populate drop down menu var session = HibernateModule.CurrentSession; var communityList = from community in session.Linq&lt;Community&gt;() select community; communityListDropDownList.DataValueField = "id"; communityListDropDownList.DataTextField = "name"; communityListDropDownList.DataSource = communityList; communityListDropDownList.DataBind(); } Response.Cache.SetCacheability(HttpCacheability.NoCache); } protected void TogglePanel(object sender, EventArgs e) { if (cbToggle.Checked) { parentCommunityPanel.Visible = true; } else { parentCommunityPanel.Visible = false; } } </code></pre> <p>Since this works fine in IE8, I tried to put a very similar code (pretty much identical) in a Web Form, and it works just fine in Firefox. Since the code above is embedded in a MasterPage, then in a Web Form, then a User Control, could all that "stacking" cause issues? I spent hours on this and I just can't find any lead or explanation that make sense.</p> <p>Edit:</p> <p>Upon checking the Error Console of Firefox, the browser reports this:</p> <p>Error: theForm is undefined Source File: <a href="http://localhost:54003/EditCommunity.aspx" rel="nofollow noreferrer">http://localhost:54003/EditCommunity.aspx</a> Line: 25</p> <p>Line 25 is the first if statement of this script:</p> <pre><code>&lt;script type="text/javascript"&gt; //&lt;![CDATA[ var theForm = document.forms['aspnetForm']; if (!theForm) { theForm = document.aspnetForm; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]&gt; &lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload