开发者

ModalPopUpExtender inside UpdatePanel causing PageRequestManagerServerErrorException: Invalid postback or callback argument

The following code displays a popup correctly, but when clicking on any button in the popup, an error is thrown (se below the code).

I cannot turn of EventValidation as it is needed for other purposes on the page. How can this be solved?

<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" CssC开发者_StackOverflow社区lass="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>

The error as shown in the Internet Explorer debugger:

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. 


I wouldn't think your ModalPopupExtender needs to be inside your UpdatePanel.

Try moving it outside and see if you still get the error.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜