UpdatePanel内部的ModalPopUpExtender导致PageRequestManagerServerErrorException:无效的回发或回调参数

时间:2011-06-08 13:46:11

标签: c# .net asp.net updatepanel modalpopupextender

以下代码正确显示弹出窗口,但是当单击弹出窗口中的任何按钮时,会抛出错误(在代码下方)。

我无法关闭EventValidation,因为页面上的其他用途需要它。 怎么解决这个问题?

<asp:UpdatePanel ID="MainUpdatePanel" runat="server" RenderMode="Inline" UpdateMode="Conditional"
ChildrenAsTriggers="false">
<ContentTemplate>
    <asp:HyperLink ID="link" runat="server"></asp:HyperLink><asp:MultiView ID="MultiViewSearchState"
        runat="server" ActiveViewIndex="0">
        <asp:View ID="ViewCommands" runat="server">
            &nbsp;<asp:Button ID="btn" runat="server" Text="Select" OnClick="btn_Click" />&nbsp;<asp:Button
                ID="ButtonClear" runat="server" Text="Clear" OnClick="ButtonClear_Click" />
        </asp:View>
        <asp:View ID="ViewSearch" runat="server">
            <asp:Panel runat="server" ID="pnlMain" CssClass="modalPopup" EnableViewState="false">
                <asp:Button ID="ButtonCancel" runat="server" Text="Cancel" OnClick="ButtonCancel_Click" />
                <dyncontrols:SearchControl runat="server" ID="searchControl" ExecuteSearch="false" />
            </asp:Panel>
            <input type="hidden" id="popupDummyTarget" runat="server" />
            <ajaxToolkit:ModalPopupExtender ID="popUpControl" runat="server" TargetControlID="popupDummyTarget"
                PopupControlID="pnlMain" BackgroundCssClass="modalBackground">
            </ajaxToolkit:ModalPopupExtender>
        </asp:View>
    </asp:MultiView>
</ContentTemplate>

Internet Explorer调试程序中显示的错误:

SCRIPT5022: Sys.WebForms.PageRequestManagerServerErrorException: 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. 

1 个答案:

答案 0 :(得分:-1)

我不认为您的ModalPopupExtender需要在UpdatePanel内。

尝试将其移到外面,看看是否仍然出现错误。