views:

2773

answers:

2

Hi, I'm trying to call a Modal Popup, but the TargetControl is in a different UpdatePanel than where the ModalPopupExtender resides.

Here's the code:

<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>

When I run the page the error "An extender can't be in a different UpdatePanel than the control it extends." is shown.

I'm trying to put a Triggers statement in the UpdatePanel2 but nothing changes:

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

Is possible to do that? Thanks

+3  A: 

Move the extender to the first update panel:

    <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>
edosoft
A: 

But I am having problem when doing a postback on a ModalPopup when this extender is inside an UpdatePanel. The popup screen is always dissapear when I click a button to do postback

HWPS LookUp  

Here am using Lookup user control. Am using grid in the user control. But the modal popup closed when popstback of any controls in the user control like sorting,paging etc.....