RadWindow for ASP.NET

Client-Side Model Send comments on this topic.
RadWindow Client-Side > Client-Side Model

Glossary Item Box

There are three properties of type string from the server-side API which are assigned the name of a client-side javascript function as a parameter.  By default this is a standard function but you can add "if" clauses in its body. The table below contains description and examples of using these properties:

 

 

  Property

   Description

  OnClientPageLoad

Gets or sets the client function to be called when a page is loaded in a Telerik RadWindow dialog.  As an argument it receives a reference to the particular window to be shown.  

Example

aspx/ascx Copy Code
<rad:RadWindowManager
                   
id= "RadWindowManager1"
                   
runat= "server"
                    
OnClientPageLoad = "OnClientPageLoad"
                   
>
                   
<windows>
                       
<rad:RadWindow id="UserListDialog"
                           
OpenerElementId = "<%# ServerButton.ClientID %>"
                           
OffsetElementId = "InfoDiv"
                           
Left= "150px"
                           
Modal = "true"
                           
Runat= "server"
                           
Width= "250px"
                           
Height= "400px"
                           
Title= "User List Dialog"
                           
NavigateUrl= "./Dialog.aspx">
                       
</rad:RadWindow>
                   
</windows>
               
</rad:RadWindowManager>


 

Javascript Copy Code
                function OnClientPageLoad(radWindow)
               {
                   alert (radWindow.Name + " has finished loading");
               }

  OnClientShow

Gets or sets the client function to be called when a window is being shown. As an argument it receives a reference to the particular window to be shown. Good for setting an argument to the window. 

Example

aspx/ascx Copy Code
<rad:RadWindowManager
                   
id= "RadWindowManager1"
                   
runat= "server"
                    
OnClientShow = "OnClientShow"
                   
>
                   
<windows>
                       
<rad:RadWindow id="UserListDialog"
                           
OpenerElementId = "<%# ServerButton.ClientID %>"
                           
OffsetElementId = "InfoDiv"
                           
Left= "150px"
                           
Modal = "true"
                           
Runat= "server"
                           
Width= "250px"
                           
Height= "400px"
                           
Title= "User List Dialog"
                           
NavigateUrl= "./Dialog.aspx">
                       
</rad:RadWindow>
                   
</windows>
               
</rad:RadWindowManager>


 

Javascript Copy Code
/* Called when a window is being shown. Good for
//setting an argument to the window */
                
function OnClientShow(radWindow)
               {
                   
alert (radWindow.Name + " is being shown");
                   var arg
= new Object();
                    
//An argument can be anything - string, number, object.
                   
//If it is an object, various properties can be
                   
//set for carrying multiple information
                   
arg.SomeValue = "Value1";
                    
//Set the argument object to the radWindow
                   
radWindow.Argument = arg;
               }

  OnClientClose

Gets or sets the client function to be called when a window is being closed. As an argument it receives a reference to the particular window to be closed.
Good for doing cleanup work.

 

Example

 

aspx/ascx Copy Code
<rad:RadWindowManager
                   
id= "RadWindowManager1"
                   
runat= "server"
                   
OnClientClose = "OnClientClose"
                   
>
                   
<windows>
                       
<rad:RadWindow id="UserListDialog"
                           
OpenerElementId = "<%# ServerButton.ClientID %>"
                           
OffsetElementId = "InfoDiv"
                           
Left= "150px"
                           
Modal = "true"
                           
Runat= "server"
                           
Width= "250px"
                           
Height= "400px"
                           
Title= "User List Dialog"
                           
NavigateUrl= "./Dialog.aspx">
                       
</rad:RadWindow>
                   
</windows>
               
</rad:RadWindowManager>

 

 

Javascript Copy Code
/* Called when a window is being closed. */
                
function OnClientClose(radWindow)
               {
                   
alert (radWindow.Name + " is being closed");
               }

 

  ClientCallBackFunction

Gets or sets the client function to be automatically called when a rad window is closed. The difference to the OnClientClose event is that a second argument is provided - the return value (if any) from the dialog.
Can also be called explicitly from within a rad window (good for scenarios where dialog should return values to the opening page multiple times). This function will be called only if there is a returned argument from the content page.
  

Example

 

aspx/ascx Copy Code
<rad:RadWindowManager
                   
id= "RadWindowManager1"
                   
runat= "server"
                   
ClientCallBackFunction= "CallBackFunction"
                   
>
                   
<windows>
                       
<rad:RadWindow id="UserListDialog"
                           
OpenerElementId = "<%# ServerButton.ClientID %>"
                           
OffsetElementId = "InfoDiv"
                           
Left= "150px"
                           
Modal = "true"
                           
Runat= "server"
                           
Width= "250px"
                           
Height= "400px"
                           
Title= "User List Dialog"
                           
NavigateUrl= "./Dialog.aspx">
                       
</rad:RadWindow>
                   
</windows>
               
</rad:RadWindowManager>

 

Javascript Copy Code
/* Can be called from within a rad window */
                
function CallBackFunction(radWindow, returnValue)
               {
     
//Do something with the return value!
    
alert (radWindow.Name + " CallBackFunction is called with
              
returnValue=" + returnValue);
               }

 

  See a live example at www.telerik.com...