gpt4 book ai didi

asp.net - 无效的回发或回调参数 - Telerik 网格中的按钮

转载 作者:行者123 更新时间:2023-12-01 09:35:51 27 4
gpt4 key购买 nike

非常著名的错误消息(见下文),从 Google 结果的数量来看。但是我见过的每个人都建议设置EnableEventValidationfalse .我搜索了整个代码库,但找不到字符串“EnableEventValidation”anywhere。此外,此代码用于工作;我所做的事情显然打破了页面。但是什么?

当我单击 Telerik RadGrid 内的按钮时发生错误,声明为:

<telerik:RadGrid ID="MyGrid" Width="100%" ItemStyle-BorderColor="Gainsboro"
ItemStyle-BorderStyle="Solid" ItemStyle-BorderWidth="1px" ActiveItemStyle-BackColor="Bisque"
SelectedItemStyle-BackColor="Black" AllowPaging="True" PageSize="15" runat="server"
AllowSorting="true" OnItemCommand="MyGrid_ItemCommand" AutoGenerateColumns="false"
OnNeedDataSource="MyGrid_NeedDataSource" GridLines="Horizontal" AllowMultiRowSelection="false"
Skin="Black">
<GroupingSettings CaseSensitive="false" />
<MasterTableView Width="100%" DataKeyNames="ID" AllowFilteringByColumn="false" Font-Names="Arial"
Font-Size="10px">
<Columns>
<telerik:GridButtonColumn ButtonType="PushButton" Text="Cancel" CommandName="Cancel"
ConfirmText="Are you sure you want to cancel this?">
</telerik:GridButtonColumn>
...
</Columns>
</MasterTableView>
<PagerStyle Mode="NextPrevAndNumeric" />
<FilterMenu EnableTheming="True">
<CollapseAnimation Duration="200" Type="OutQuint" />
</FilterMenu>
</telerik:RadGrid>

单击“取消”按钮,这是著名的错误:

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.

最佳答案

问题出在:在我的 Page_Load 方法中:

protected void Page_Load(object sender, EventArgs e) {
MyGrid.Rebind();
}

在回发时重新绑定(bind)网格显然是搞砸了。我把它改成:

protected void Page_Load(object sender, EventArgs e) {
if (!IsPostBack) {
MyGrid.Rebind();
}
}

现在一切正常。

关于asp.net - 无效的回发或回调参数 - Telerik 网格中的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8204736/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com