Note that there are some explanatory texts on larger screens.

plurals
  1. POUnmodified DropDownList in UpdatePanel causes Event Validation error in FireFox
    text
    copied!<p><strong>Background</strong><br> I have an ASP.net UserControl that is a simple user input form. It uses an UpdatePanel and UpdaetProgress to display a "working" gif after they click submit. We have gotten reports that the submit button sometimes doesn't do anything in FireFox, IE 8, and Safari. When looking into that, I couldn't reproduce any problems in IE, but found that in FireFox, the submit button got the following script error which was preventing the postback:</p> <pre><code>Error: Sys.WebForms.PageRequestManagerServerErrorException: Invalid postback or callback argument. Event validation is enabled using &lt;pages enableEventValidation="true"/&gt; in configuration or &lt;%@ Page EnableEventValidation="true" %&gt; in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. Source File: http://localhost:1127/ScriptResource.axd?d=ZYU-uPMJ_AcQgBrmkW_WO13JlNZSAb9cMptxJsQIH1LnA8NC31pa7PAk8l5lYCB8LDDwft7xwh7Z107MKgt7KHHBeQaeEncnAFKLJ04CaHgelsuOOv072-1ZBvMW7N_x0&amp;t=3693a5e0 Line: 1111 </code></pre> <p><strong>Problem</strong><br> To figure out what was causing the error, I gradually whittled down my code until I had almost nothing left. What I found was that when I select from a DropDownList in an UpdatePanel, the button gets this error (in FireFox only). If I remove the DropDownList, don't make a selection, or remove the UpdatePanel, the submit button posts back correctly (any 1 of those).</p> <p><strong>Example</strong><br> Create an ASP.net 3.5 project and place the code below in an aspx page. Set a break point in your Page_Load or OnClick event handler in the code behind. Run it, make a selection from the DropDownList and then ClickSubmit. Notice the breakpoints are not hit.</p> <pre><code>&lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:ScriptManager runat="server"&gt; &lt;/asp:ScriptManager&gt; &lt;div id="Div1" class="form-layout membership payment"&gt; &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server" RenderMode="Inline"&gt; &lt;contenttemplate&gt; &lt;table cellpadding="0" cellspacing="0" border="0" class="form_table payment"&gt; &lt;tr&gt; &lt;th align="right" valign="top"&gt; State &lt;span class="reqd"&gt;*&lt;/span&gt; &lt;/th&gt; &lt;td&gt; &lt;asp:DropDownList Width="75px" ID="ddlState" CssClass="txt" runat="server" AutoPostBack="false"&gt; &lt;asp:ListItem Value="" Text="--Select--" /&gt; &lt;asp:ListItem&gt;AB &lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;AL &lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;div class="clear-left pad-bottom"&gt; &lt;/div&gt; &lt;asp:Label ID="lblCreditCardError" CssClass="creditCardError" runat="server"&gt; &lt;/asp:Label&gt; &lt;table cellpadding="0" cellspacing="0" border="0" class="form_table"&gt; &lt;tr&gt; &lt;th align="right" valign="top"&gt; &lt;/th&gt; &lt;td&gt; &lt;asp:HiddenField ID="HFSubmitForm" runat="server" Value="0" /&gt; &lt;asp:Button ID="btnTest" runat="server" OnClick="btnSubmitCC_Click" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/contenttemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>I don't think using markup should matter anyway, but I tried adding the items to the DropDownList using binding in an if(!IsPostBack) block in the Page_Load method, but it didn't change anything.</p>
 

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