Reputation: 191
I have a DevExpress ASPxPopup control on a page. Now I want to show that popup when I click the link on the menu bar which is in master page.
I can access popup in master page using Master.FindControl() but I don't know how to access popup in a child page.
Upvotes: 0
Views: 2453
Reputation: 18290
If you know that When page is completely loaded then Master page and child aspx page rendered html markup and script are available to work with it. So you can access both popupControls on either Master page or ChildPage.
Just Assign Set ASPxPopupControl.ClientInstanceName and use button's clientside event to show or hide the popup.
Check the following working example: //Master page markup
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<dx:ASPxPopupControl ID="parentPopupControl" ClientInstanceName="parentPopup" runat="server">
<ContentCollection>
<dx:PopupControlContentControl runat="server" SupportsDisabledAttribute="True">this
is parent popup</dx:PopupControlContentControl>
</ContentCollection>
</dx:ASPxPopupControl>
<dx:ASPxHyperLink ID="hlnkShowChildPopup" runat="server" Text="Show Child Popup">
<ClientSideEvents Click="function(s, e) {
childPopup.Show();
}" />
</dx:ASPxHyperLink>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>`
///Child Page Markup
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<dx:ASPxPopupControl ID="childPopupControl" runat="server"
ClientInstanceName="childPopup">
<ContentCollection>
<dx:PopupControlContentControl runat="server" SupportsDisabledAttribute="True">this
is child popup control</dx:PopupControlContentControl>
</ContentCollection>
</dx:ASPxPopupControl>
<dx:ASPxHyperLink ID="hlnkShowParentPopup" runat="server" Text="Show Parent Popup">
<ClientSideEvents Click="function(s, e) {
parentPopup.Show();
}" />
</dx:ASPxHyperLink>
</asp:Content>`
Note: You can't consume popup control in better way with server side includes, so take a learning on callbacks and callbackpanel etc to work client side scripts.
Hope this help you..
Upvotes: 2
Reputation: 3347
You can implement this on client side. Set ASPxPopupControl.ClientInstanceName. Then use popup contorl client side methods like Show or ShowWindow.
Upvotes: 1