OnClientPageLoad
The OnClientPageLoad event of the RadWindow fires when the pageset through its NavigateUrl property finishes loading. Since this page is loaded inside an iframe, this event is fired by the iframe's onload
event.
You can use this event to know when the page is loaded inside the popup, including pages changed dynamically via the setUrl()
method the client-side API of the control exposes. At this point you can call the autoSize()
method of the control, for example, or call a function in the loaded page to modify it or provide data to it.
The event handler receives the following arguments:
The RadWindow object that fired the event.
An event arguments object that does not expose any methods and properties.
RadWindow takes the
<title>
of its content page and sets it as its own title in the OnClientPageLoad event. This will override theTitle
server property or earlier calls to theset_status
client-side method. If you want to override the content page title, see Examples 1-3.
When a content page is loaded in the RadWindow, its URL is set in the status bar of the control in this event, so if you need to modify or remove it, this is the point at which you can use the
set_status()
client-side method (see Examples 4-5). An alternative is to set theVisibleStatusbar
property tofalse
to avoid having the statusbar at all.
<telerik:RadWindow ID="RadWindow1" runat="server" NavigateUrl="~/some-page.aspx" VisibleOnPageLoad="true"
OnClientPageLoad="changeTitle"></telerik:RadWindow>
<script>
function changeTitle(sender, args) {
sender.set_title("my custom title");
}
</script>
<telerik:RadWindow ID="RadWindow1" runat="server" NavigateUrl="~/images/logo.jpg" VisibleOnPageLoad="true"
OnClientPageLoad="changeTitle"></telerik:RadWindow>
<script>
function changeTitle(sender, args) {
sender.set_title("Image");
}
</script>
If you want the RadWindow title to come from the server, you can use a custom attribute. See Example 3.
<telerik:RadWindow ID="RadWindow1" runat="server" NavigateUrl="~/some-page.aspx" VisibleOnPageLoad="true"
OnClientPageLoad="changeTitle" CustomTitle="my desired title"></telerik:RadWindow>
<script>
function changeTitle(sender, args) {
sender.set_title(sender.get_element().getAttribute("CustomTitle"));
}
</script>
<telerik:RadWindow ID="RadWindow1" runat="server" NavigateUrl="~/some-page.aspx" VisibleOnPageLoad="true"
OnClientPageLoad="changeStatus"></telerik:RadWindow>
<script>
function changeStatus(sender, args) {
sender.set_status("custom status");
}
</script>
<telerik:RadWindow ID="RadWindow1" runat="server" NavigateUrl="~/some-page.aspx" VisibleOnPageLoad="true"
OnClientPageLoad="changeStatus"></telerik:RadWindow>
<script>
function changeStatus(sender, args) {
sender.set_status("");
}
</script>