I have a User Control called: Share.ascx
I have a page called: News.aspx
In News.aspx I created a ModalPopupExtender, then I addeda Panel and inside the Panel I added the User Control: Share.ascx so that when the Popup Extender is called the Panel with the User Control is displayed.
The problem:
I can only HIDE the ModalPopupExtender from News.aspx because ModalPopupExtender is defined there but I need to call the HIDE funciton of ModalPopupExtender from the User Control: Share.ascx.cs
How do I do that?
Thank you.
———————-News.aspx————————-
<asp:Content ID="Content1" runat="server">
<asp:LinkButton ID="lbtnShare" runat="server" Text='Share Link' />
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
TargetControlID="lbtnShare" PopupControlID="Panel1"
Drag="true" RepositionMode=RepositionOnWindowResizeAndScroll
BackgroundCssClass="modalBackground" >
</asp:ModalPopupExtender>
<asp:panel id="Panel1" runat="server" style="display:none">
<uc2:ShareLink ID="ShareLink" runat="server" />
</asp:panel>
</asp:Content>
———————-Share.ascx————————-
<asp:UpdatePanel ID="upSET" runat="server">
<ContentTemplate>
<asp:Button ID="btnCancel" Text="Cancel" runat="server" OnClick="btnCancel_Click" CausesValidation="false" />
</ContentTemplate>
</asp:UpdatePanel>
The files are too long so I omitted a lot of it and only put the important parts.
Share.ascx has a Cancel button, in that button I want to call the Hide() function of ModalPopupExtender1 that is located in News.aspx.
From the usercontrol code behind try to find your ModalPopupExtender
and then call the Hide() method