好的,所以我在gridview中有一个只包含一个简单按钮的模板字段……
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Administration.aspx.cs" Inherits="Administration" %> <%@ Register TagPrefix="ajaxToolkit" Namespace="AjaxControlToolkit" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Keywords Administration</title> </head> <body class="popupbody"> <form id="form1" runat="server"> <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePartialRendering="true" CombineScripts="false"></ajaxToolkit:ToolkitScriptManager> <asp:Label ID="AddLabel" runat="server">Add a Keyword</asp:Label> <br /> <asp:TextBox ID="AddTextBox" runat="server" /> <asp:Button ID="AddButton" Text="Add" runat="server" OnClick="AddKeyword_Click" /> <asp:GridView ID="KeywordsGridView" AllowPaging="false" AutoGenerateColumns="false" BackColor="white" GridLines="None" HeaderStyle-CssClass="Table_Header" RowStyle-CssClass="Table_Style" OnRowDataBound="RowBound" runat="server"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:Button runat="server" /> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="References" SortExpression="References" HeaderText="Total References" /> <asp:BoundField DataField="Keyword" SortExpression="Keyword" HeaderText="Keyword" /> </Columns> </asp:GridView> </form> </body> </html>
每当我点击按钮,我都会收到错误…
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> 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.
我找到了大量引用这个问题的文章,包括一些关于SO的文章,例如……
和…
Invalid postback or callback argument
我可能只是误会,但据我所知,他们并没有真正帮助我.如何在不设置enableEventValidation =“false”的情况下让它消失?