Вызов модального всплывающего окна с TargetControl в другом UpdatePanel в ASP.NET

Я пытаюсь вызвать модальное всплывающее окно, но TargetControl находится в другой UpdatePanel, чем ModalPopupExtender.

Вот код:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
    </ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel2" runat="server"  UpdateMode="Conditional">
    <ContentTemplate>
        <asp:Panel ID="Panel1" runat="server">
        Test
        </asp:Panel>
        <cc1:ModalPopupExtender ID="Panel1_ModalPopupExtender" runat="server" 
            DynamicServicePath="" Enabled="True" TargetControlID="LinkButton1" PopupControlID="Panel1">
        </cc1:ModalPopupExtender>
    </ContentTemplate>
</asp:UpdatePanel>

Когда я запускаю страницу, появляется ошибка «Расширитель не может находиться в другой UpdatePanel, чем элемент управления, который он расширяет». Показано.

Я пытаюсь поместить оператор Triggers в UpdatePanel2, но ничего не меняется:

<Triggers>
        <asp:AsyncPostBackTrigger ControlID="LinkButton1" EventName="Click" />
    </Triggers>

Возможно ли это? Спасибо


person segaco    schedule 16.04.2009    source источник


Ответы (1)


Переместите расширитель на первую панель обновления:

    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
                <ajaxToolkit:ModalPopupExtender ID="Panel1_ModalPopupExtender" runat="server" 
            DynamicServicePath="" Enabled="True" TargetControlID="LinkButton1" PopupControlID="Panel1">
        </ajaxToolkit:ModalPopupExtender>

    </ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel2" runat="server"  UpdateMode="Conditional">
    <ContentTemplate>
        <asp:Panel ID="Panel1" runat="server">
        Test
        </asp:Panel>
    </ContentTemplate>
</asp:UpdatePanel>
person edosoft    schedule 16.04.2009