Note that there are some explanatory texts on larger screens.

plurals
  1. POTemplateField button causing GridView Invalid Postback
    primarykey
    data
    text
    <p>Ok, so I've got a template field in a gridview that contains just a simple button...</p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Administration.aspx.cs" Inherits="Administration" %&gt; &lt;%@ Register TagPrefix="ajaxToolkit" Namespace="AjaxControlToolkit" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;Keywords Administration&lt;/title&gt; &lt;/head&gt; &lt;body class="popupbody"&gt; &lt;form id="form1" runat="server"&gt; &lt;ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePartialRendering="true" CombineScripts="false"&gt;&lt;/ajaxToolkit:ToolkitScriptManager&gt; &lt;asp:Label ID="AddLabel" runat="server"&gt;Add a Keyword&lt;/asp:Label&gt; &lt;br /&gt; &lt;asp:TextBox ID="AddTextBox" runat="server" /&gt; &lt;asp:Button ID="AddButton" Text="Add" runat="server" OnClick="AddKeyword_Click" /&gt; &lt;asp:GridView ID="KeywordsGridView" AllowPaging="false" AutoGenerateColumns="false" BackColor="white" GridLines="None" HeaderStyle-CssClass="Table_Header" RowStyle-CssClass="Table_Style" OnRowDataBound="RowBound" runat="server"&gt; &lt;Columns&gt; &lt;asp:TemplateField&gt; &lt;ItemTemplate&gt; &lt;asp:Button runat="server" /&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:BoundField DataField="References" SortExpression="References" HeaderText="Total References" /&gt; &lt;asp:BoundField DataField="Keyword" SortExpression="Keyword" HeaderText="Keyword" /&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Whenever I click the button I get the error...</p> <pre><code>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. </code></pre> <p>I've found a decent amount of articles referencing this issue, including a couple on SO, for example...</p> <p><a href="https://stackoverflow.com/questions/228969/asp-net-invalid-postback-or-callback-argument-event-validation-is-enabled-usi">Invalid postback or callback argument. Event validation is enabled using &#39;&lt;pages enableEventValidation=&quot;true&quot;/&gt;&#39;</a></p> <p>and...</p> <p><a href="https://stackoverflow.com/questions/103560/invalid-postback-or-callback-argument">Invalid postback or callback argument</a></p> <p>I might just be misunderstanding, but as far as I can tell they don't really help me. How do I get this to go away without setting enableEventValidation="false"?</p> <p><b>EDIT</b> Posted all the code for my page.</p>
    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.
 

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