ASPxClientPopupControlBase.SetContentUrl(url) Method
Sets the URL to point to the web page that should be loaded into, and displayed within the control’s window.
Declaration
SetContentUrl(
url: string
): void
Parameters
Name |
Type |
Description |
url |
string |
A string value specifying the URL to the web page displayed within the control’s window.
|
The SetContentUrl method can be used on the client side to specify the URL of the web page to be displayed as the content of the control’s window. The web page’s URL can be either an absolute or relative path.
Example
If a content of the ASPxPopupControl is loaded slowly, you can show a loading panel reflecting this process.
View Example
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestPage.aspx.cs" Inherits="TestPage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2> Page content </h2>
</div>
</form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.Web.ASPxLoadingPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>ASPxLoadingPanel within ASPxPopupControl</title>
<script language="javascript" type="text/javascript">
var showPopup = true;
var iframe;
function OnPopupInit (s, e) {
iframe = popup.GetContentIFrame();
/* the "load" event is fired when the content has been already loaded */
ASPxClientUtils.AttachEventToElement(iframe, 'load', OnContentLoaded);
}
function OnPopupShown (s, e) {
if (showPopup)
lp.ShowInElement(iframe);
}
function OnContentLoaded (e) {
showPopup = false;
lp.Hide();
}
function OnButtonClick (s, e) {
showPopup = true;
popup.SetContentUrl(txt.GetText());
popup.Show();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
<b>Web site URL:</b>
</td>
<td>
<dx:ASPxTextBox ID="txt" ClientInstanceName="txt" runat="server" Width="250px" Text="TestPage.aspx">
</dx:ASPxTextBox>
</td>
</tr>
</table>
<dx:ASPxLoadingPanel ID="lp" runat="server" ClientInstanceName="lp">
</dx:ASPxLoadingPanel>
<dx:ASPxPopupControl ID="popup" runat="server" AllowDragging="true" AllowResize="true"
Height="400px" Width="600px" ClientInstanceName="popup" ContentUrl="javascript:void(0);"
PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter">
<ClientSideEvents Init="OnPopupInit" Shown="OnPopupShown" />
</dx:ASPxPopupControl>
<dx:ASPxButton ID="btn" runat="server" Text="Show the Site" AutoPostBack="false">
<ClientSideEvents Click="OnButtonClick" />
</dx:ASPxButton>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class TestPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Thread.Sleep(3000);
}
}
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DevExpress.Web.ASPxClasses;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
<%@ Page Language="vb" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.Web.ASPxLoadingPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>ASPxLoadingPanel within ASPxPopupControl</title>
<script language="javascript" type="text/javascript">
var showPopup = true;
var iframe;
function OnPopupInit (s, e) {
iframe = popup.GetContentIFrame();
// the "load" event is fired when the content has been already loaded
ASPxClientUtils.AttachEventToElement(iframe, 'load', OnContentLoaded);
}
function OnPopupShown (s, e) {
if (showPopup)
lp.ShowInElement(iframe);
}
function OnContentLoaded (e) {
showPopup = false;
lp.Hide();
}
function OnButtonClick (s, e) {
showPopup = true;
popup.SetContentUrl(txt.GetText());
popup.Show();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
<b>Web site URL:</b>
</td>
<td>
<dx:ASPxTextBox ID="txt" ClientInstanceName="txt" runat="server" Width="250px" Text="TestPage.aspx">
</dx:ASPxTextBox>
</td>
</tr>
</table>
<dx:ASPxLoadingPanel ID="lp" runat="server" ClientInstanceName="lp">
</dx:ASPxLoadingPanel>
<dx:ASPxPopupControl ID="popup" runat="server" AllowDragging="true" AllowResize="true"
Height="400px" Width="600px" ClientInstanceName="popup" ContentUrl="javascript:void(0);"
PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter">
<ClientSideEvents Init="OnPopupInit" Shown="OnPopupShown" />
</dx:ASPxPopupControl>
<dx:ASPxButton ID="btn" runat="server" Text="Show the Site" AutoPostBack="false">
<ClientSideEvents Click="OnButtonClick" />
</dx:ASPxButton>
</div>
</form>
</body>
</html>
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Partial Public Class TestPage
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Thread.Sleep(3000)
End Sub
End Class
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports DevExpress.Web.ASPxClasses
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
End Sub
End Class
<%@ Page Language="vb" AutoEventWireup="true" CodeFile="TestPage.aspx.vb" Inherits="TestPage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2> Page content </h2>
</div>
</form>
</body>
</html>
See Also