Skip to main content

Displaying External Content

  • 2 minutes to read

A Splitter allows you to display external web pages as the content of splitter panes.

You can use the SplitterPane.ContentUrl (via MVCxSplitterPane.ContentUrl) property of a pane object to specify the URL of the web page to be displayed within the pane. A web page, specified by this property, is displayed within a pane occupying its entire area. If any other content is defined within a pane explicitly (in the aspx markup or programmatically), it is ignored and not displayed in this case. If the size of a pane is not enough to accommodate the entire web page, set the pane’s SplitterPane.ScrollBars (via MVCxSplitterPane.ScrollBars) property to Auto.

On the client side, you can identify the web page loaded into a pane by calling the pane’s ASPxClientSplitterPane.GetContentUrl method. Moreover, you can also dynamically load a specific web page into a pane by using the client ASPxClientSplitterPane.SetContentUrl method.

The following code demonstrates a Splitter with two panes. The content of the first pane is specified via the ContentUrl property. The second pane, which is initially empty, loads its content web page dynamically on the client side after a button is clicked.

View code (ASPX):

<%
    Html.DevExpress().Splitter(
    settings => {
        settings.Name = "MySplitter";
        settings.Height = 500;
        settings.Panes.Add (pane => {
            pane.Name = "MyPane1";
            pane.ContentUrl = "https://search.devexpress.com/?q=ASPxSplitter&f=&m=Web;p=T0|P0|0&amp;d=447";
            pane.ScrollBars = System.Web.UI.WebControls.ScrollBars.Auto;
        });
        settings.Panes.Add(pane => {
            pane.Name = "MyPane2";
            pane.ContentUrl = "about:blank";
            pane.ScrollBars = System.Web.UI.WebControls.ScrollBars.Auto;
        });
    }).Render();            
%>
<%
    Html.DevExpress().Button(
        settings => {
            settings.Name = "MyButton";
            settings.Text = "Search Google";
            settings.ClientSideEvents.Click = "function(s, e) { var pane = MySplitter.GetPaneByName('MyPane2'); pane.SetContentUrl('http://www.google.com/');}";
        }).Render();
%>

View code (Razor):

@Html.DevExpress().Splitter(
    settings => {
        settings.Name = "MySplitter";
        settings.Height = 500;
        settings.Panes.Add (pane => {
            pane.Name = "MyPane1";
            pane.ContentUrl = "https://search.devexpress.com/?q=ASPxSplitter&f=&m=Web;p=T0|P0|0&amp;d=447";
            pane.ScrollBars = System.Web.UI.WebControls.ScrollBars.Auto;
        });
        settings.Panes.Add(pane => {
            pane.Name = "MyPane2";
            pane.ContentUrl = "about:blank";
            pane.ScrollBars = System.Web.UI.WebControls.ScrollBars.Auto;
        });
    }).GetHtml()

@Html.DevExpress().Button(
    settings => {
        settings.Name = "MyButton";
        settings.Text = "Search Google";
        settings.ClientSideEvents.Click = "function(s, e) { var pane = MySplitter.GetPaneByName('MyPane2'); pane.SetContentUrl('http://www.google.com/');}";
    }).GetHtml()

The resulting appearance is illustrated in the image below.

ASPxSplitter-ExternalContent.png