Skip to content

Use one Popup Control across all pages of your application to improve performance.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/asp-net-web-forms-popup-use-one-popup-for-entire-application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Popup Control for ASP.NET Web Forms - How to use one pop-up across all pages of an application

You can use one Popup Control across all pages of your application to improve performance. This example demonstrates how to create a popup control on the master page and invoke it from multiple pages. The pop-up window's content depends on the page that shows this window.

Popup Window

In this example, the page WebForm1 populates the pop-up window with content during control initialization. The page WebForm2 specifies the window's content once the control sends a callback to the server. Use menu items Init approach and Callback approach to switch between these pages. Click the Show Popup button to show the pop-up window.

Overview

Follow the steps below to use one pop-up across multiple pages:

  1. Place an empty popup control in the root master page.

  2. Select the event that will generate pop-up window content:

    • The Init event allows you to create pop-up window content at runtime during popup control initialization.
    • The WindowCallback event allows you to dynamically create pop-up window content once the window sends a callback.

    The code snippet below assigns a handler to the Init event:

    <dx:ASPxPopupControl ID="popupControl" runat="server" ClientInstanceName="popup" 
        OnInit="popupControl_Init" />
  3. Create a delegate for the event you selected in the previous step:

    public event EventHandler PopupInit;
    protected void popupControl_Init(object sender, EventArgs e) {
        if (PopupInit != null)
            PopupInit(sender, e);
    }
  4. Specify the master page's type name in all pages where you want to display pop-up windows:

    <%@ MasterType TypeName="T501713.Root" %>
  5. In these pages, call the event delegate and populate the pop-up window with content:

    protected void Page_PreInit(object sender, EventArgs e) {
        Master.PopupInit += Master_PopupInit;
    }
    
    private void Master_PopupInit(object sender, EventArgs e) {
        // Populate the pop-up window with page-specific content
    }
  6. Use the popup control's client instance name to show the pop-up window:

    function button1_Click(s, e) {
        popup.Show();
    }

Files to Review

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)