I included a repeater in my master page. The repeater has a button that I set its CommandArgument.
我在我的母版页中包含了一个转发器。转发器有一个我设置其CommandArgument的按钮。
However when I click the button I get the following exception:
但是,当我单击按钮时,我得到以下异常:
System.ArgumentException: Invalid postback or callback argument. Event validation is enabled using 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.
System.ArgumentException:无效的回发或回调参数。使用配置或页面中的<%@ Page EnableEventValidation =“true”%>启用事件验证。出于安全考虑,此功能可验证回发或回调事件的参数是否来自最初呈现它们的服务器控件。如果数据有效且符合预期,请使用ClientScriptManager.RegisterForEventValidation方法注册回发或回调数据以进行验证。
And it doesn't continue to the event handler.
它不会继续事件处理程序。
Note: I tried adding these lines to the master page but it doesn't help:
注意:我尝试将这些行添加到母版页但不起作用:
protected override void Render(HtmlTextWriter writer)
{
Page.ClientScript.RegisterForEventValidation(rptrLanguages.ClientID);
base.Render(writer);
}
Thanks.
1 个解决方案
#1
Are you doing any databinding on that page? If so, is it happening between a check for !IsPostBack ?
你在那个页面上做过任何数据绑定吗?如果是这样,它是否在支票之间发生!IsPostBack?
if (!IsPostBack) { // do databinding }
A similar issue was mentioned here.
这里提到了类似的问题。
#1
Are you doing any databinding on that page? If so, is it happening between a check for !IsPostBack ?
你在那个页面上做过任何数据绑定吗?如果是这样,它是否在支票之间发生!IsPostBack?
if (!IsPostBack) { // do databinding }
A similar issue was mentioned here.
这里提到了类似的问题。