我们将此更新面板与此列表视图一起使用。
<asp:UpdatePanel ID="searchResultUpdate" runat="server">
<Triggers><asp:AsyncPostBackTrigger ControlID="submitBT"/></Triggers>
<ContentTemplate>
<div id="status" runat="server" />
<asp:ListView ID="searchResultLV" runat="server" OnItemCommand="searchResultLV_ItemCommand" DataKeyNames="Message_id" OnItemDeleting="searchResultLV_ItemDeleting">
<LayoutTemplate>
<table class="table table-hover">
<tr runat="server" id="itemPlaceholder" />
</table>
</LayoutTemplate>
<ItemTemplate>
</ItemTemplate>
</asp:ListView>
</ContentTemplate>
</asp:UpdatePanel>
用searchResultLV.DataBind()更新列表视图后的;在部分回发中,然后在相应的master.page
中单击此按钮<button id="LogoutAnchor" runat="server" onserverclick="LogoutAnchor_ServerClick" class="btn btn-default btn-flat">Sign out</button>
在调用函数(LogoutAnchor_ServerClick)之前,发生错误:
[ArgumentException: 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.]
这是一个错误吗?我们不能在服务器上使用部分回发和完全回发吗?
答案 0 :(得分:1)
移动Page_Load
事件中的所有代码,如下所示。
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
// all your code here which should be executed only once
}
}
<%@ Page EnableEventValidation="false" %>