Search code examples
c#asp.netajaxcontroltoolkit

Setting up a button to trigger both modalPopupExtender and his Click Method


I have this modalPopupExtender, I want it to show a CheckBoxList with some data. I have set up a button to call both the method to fill the CheckBoxes and trigger the modalPopup (TargetControlID). they're all inside an UpdatePanel. with the right triggers. The problem is that when I click the button it shows the modalPopup but doesn't load the method to fill my CheckBoxes...

Also, a linkButton inside the poup (linkButtonCheckAll) just closes the popup when clicked.

When I remove the modalPopup the code works just fine and the list is loaded dinamically with the UpdatePanel.

<asp:UpdatePanel ID="uppLote" runat="server">
        <ContentTemplate>
            <ajaxToolkit:ModalPopupExtender ID="modalLote" runat="server" BehaviorID="popup"
                TargetControlID="buttonViewLote" PopupControlID="panelLote" />
            <asp:Panel ID="panelLote" runat="server" CssClass="modalpopup">
                     <asp:LinkButton ID="linkButtonCheckAll" runat="server"

                            Text="Check All Items" onclick="linkButtonCheckAll_Click"></asp:LinkButton>
                     <asp:CheckBoxList ID="checkListLote" runat="server">
                     </asp:CheckBoxList>
            </asp:Panel>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="linkButtonViewLote" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="linkButtonCheckAll" EventName="Click" />
        </Triggers>
</asp:UpdatePanel>

If I completely remove the modalPopupExtender, the code works fine, showing me the list I want with the method "linkButonViewLote_Click" (so, the problem is occurring due to the button triggering the modalPopupExtender is the same that I'm using to get my data, right? Any solutions?


Solution

  • You can try setting the TargetControlID to a dummy control on the page and have buttonViewLote click event call modalLote.Show().