New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

RadWindow Object

In this article, we list the numerous client-side properties and methods exposed by the client-side RadWindow object. These properties and methods allow you to manipulate the windows in the browser. Additionally, you can use these methods in various client-side events and produce the logic required by your scenario.

At the end of the article, you will find a basic example that demonstrates how to call methods, set properties, and handle events.

You can also create RadWindow instances dynamically through the RadWindowManager client-side object.

This article contains the following sections:

Getters/Setters for the Public Properties

Getters/setters for the public properties

NameDescription
BrowserWindowReturns a reference to the parent page's document. This is useful for calling functions on the parent page.
get_animationGets the animation value for the RadWindow . Returns a variable of type Telerik.Web.UI.WindowAnimation.
get_animationDurationGets animation duration value for the RadWindow . The default value is 500ms.
get_autoSizeGets a value that indicates whether the window will automatically resize itself according to its content or not.
get_browserWindowGets a reference to the RadWindow's parent [browser window] object.
get_centerIfModalReturns a Boolean value whether CenterIfModal is set.
get_contentElementGets the content element when the RadWindow is used as a controls container (its ContentTemplate ) and not with NavigateUrl .
get_contentFrameReturns a reference to RadWindow's content area (IFRAME). One possible use is to call a function that is declared in the RadWindow's page from the parent page. Another possible use is to modify the DOM.
get_cssClassGets the class name specified in the CssClass property.
get_destroyOnCloseGets a value indicating whether the RadWindow will be disposed and made inaccessible once it is closed.
get_enableShadowGets a value indicating whether the RadWindow should have a shadow.
get_heightGets the value of the RadWindow's server Height property. To get the current dimensions, use the getWindowBounds method.
get_iconUrlGets the URL of the icon in the upper-left corner of the RadWindow titlebar.
get_keepInScreenBoundsGets a value indicating whether the RadWindow will show only in the visible viewport of the browser window.
get_leftGets the horizontal offset relative to its offset element (usually the browser window). Corresponds to the Left server property and returns its value. To get the current position, use the getWindowBounds method.
get_maxHeightGets the maximum height of the RadWindow .
get_maxWidthGets the maximum width of the RadWindow .
get_minHeightGets the minimum height of the RadWindow .
get_minimizeIconUrlGets the URL of the minimized icon of the RadWindow .
get_minimizeZoneIDGets the ID ( ClientID if a runat=server is used) of an HTML element where the RadWindow object will be docked when minimized.
get_minWidthGets the minimum width of the RadWindow .
get_modalGets a value indicating whether the RadWindow is modal or not.
get_nameGets the name of the RadWindow .
get_navigateUrlGets the URL of the RadWindow .
get_offsetElementIDGets the offset element ID (the element according to which the RadWindow should be positioned relatively). Works together with the Top and Left properties.
get_opacityGets the value indicating the opacity of the RadWindow . The value should be between 0 and 100. The default value is 100, which is opaque.
get_openerElementIDGets the OpenerElementId of the RadWindow .
get_overlayGets a value indicating whether the RadWindow has an overlay element.
get_popupElementReturns a reference to the popup element of the RadWindow .
get_reloadOnShowGets a value indicating whether the page that is loaded in the RadWindow should be loaded every time from the server or whether the browser's default behavior will be left.
get_restrictionZoneIDGets the ID ( ClientID if a runat=server is used) of an HTML element in which the RadWindow object will be able to move.
get_showContentDuringLoadGets a value indicating whether the page that is loaded in the RadWindow should be shown during the loading process or only when it has finished loading.
get_showOnTopWhenMaximizedGets a value indicating whether the maximized RadWindow should be on top of the page's content. The default value is True .
get_statusGets current message in the status area of the RadWindow .
get_titleGets the title of the RadWindow .
get_topGets the vertical offset relative to its offset element. Corresponds to the Top server property and returns its value. To get the current position, use the getWindowBounds method.
get_visibleStatusbarGets the visibility of the RadWindow's status bar.
get_visibleTitlebarGets the visibility of the RadWindow's titlebar.
get_widthGets the value of the RadWindow's server Width property. To get the current dimensions, use the getWindowBounds method.
get_windowManagerReturns a reference to the RadWindowManager . As an alternative, you can use the ASP.NET AJAX convention and use $find(), for example: oManager = $find("<%=RadWindowManager1.ClientID%>");
get_zindexGets the Z-index of the RadWindow .
set_animationSets the opening animation for the RadWindow . Takes an argument of type Telerik.Web.UI.WindowAnimation. Possible values are: None , Resize , Fade , Slide , FlyIn . For example: oWnd.set_animation(Telerik.Web.UI.WindowAnimation.Slide);
set_animationDurationSets the animation duration value for the RadWindow .
set_autoSizeSets a value that indicates whether the window should automatically resize itself according to its content or not.
set_autoSizeBehaviorsSets the AutoSizeBehaviors property of the RadWindow . Its argument must be a value or combination of values from the Telerik.Web.UI.WindowAutoSizeBehaviors enum. To set more than one behavior, use "+". Possible values are Width , WidthProportional , Height , HeightProportional and Default . For example: (Telerik.Web.UI.WindowAutoSizeBehaviors.Width + Telerik.Web.UI.WindowAutoSizeBehaviors.Height)
set_behaviorsSets the Behaviors property of the RadWindow . Its argument must be a value or combination of values from the Telerik.Web.UI.WindowBehaviors enum. To set more than one behavior, use "+". Possible values are: None , Resize , Minimize , Close , Pin , Maximize , Move , Reload , Default . For example: oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close)
set_centerIfModalSets the CenterIfModal property. It is True by default, meaning a modal RadWindow will ignore the Left and Top properties. When set to False , these properties will be respected. Can be useful in the OnClientBeforeShow event.
set_contentElementSets the content element when the RadWindow is used as a controls container (i.e., its ContentTemplate ) and not with NavigateUrl . Takes a DOM object as a parameter.
set_destroyOnCloseSets a value indicating whether the RadWindow will be disposed and made inaccessible once it is closed.
set_enableShadowSets a value indicating whether the RadWindow should have a shadow.
set_heightSets the RadWindow height in pixels.
set_iconUrlSets the URL of the icon in the upper-left corner of the RadWindow title bar. The new image must also be 16x16 pixels in size for correct display.
set_initialBehaviorsSets the InitialBehaviors property of the RadWindow . Its argument must be a value or combination of values from the Telerik.Web.UI.WindowBehaviors enum. To set more than one behavior, use "+". Possible values are: None , Minimize , Pin , Maximize and Default . For example: oWnd.set_initialBehaviors(Telerik.Web.UI.WindowBehaviors.Pin + Telerik.Web.UI.WindowBehaviors.Maximize)
set_keepInScreenBoundsSets a value indicating whether the RadWindow should show only in the visible viewport of the browser window.
set_leftSets the horizontal offset relative to its offset element in pixels. Corresponds to the Left server property.
set_maxHeightSets the maximum height of the RadWindow in pixels.
set_maxWidthSets the maximum width of the RadWindow in pixels.
set_minHeightSets the minimum height of the RadWindow in pixels.
set_minimizeIconUrlSets the URL of the minimized icon of the RadWindow .
set_minimizeZoneIDSets the client-side ID of an HTML element where the window object will be docked when minimized.
set_minWidthSets the minimum width of the RadWindow in pixels.
set_modalSets the modality of the RadWindow . It accepts a Boolean value as an argument, e.g., oWnd.set_modal(true);
set_navigateUrlSets the URL RadWindow will navigate to. Does not create the markup of the dialog or load the content page. To load the content page and show the dialog use setUrl and show respectively.
set_offsetElementIDSets the OffsetElementId (client-side ID of an HTML element where RadWindow will be positioned).
set_opacitySets the value indicating the opacity of the Boolean. The value should be between 0 and 100. The default value is 100, which is opaque.
set_openerElementIDSets the OpenerElementId for the RadWindow . This is the HTML element that will open the RadWindow when clicked. Note that if it is a postback element, its server-side handlers will not fire.
set_overlaySets a value indicating whether the RadWindow should create an overlay element.
set_reloadOnShowSets a value indicating whether the page that is loaded in the RadWindow should be loaded every time from the server or whether the browser's default behavior will be left.
set_restrictionZoneIDSets the client-side ID of an HTML element in which the window object will be able to move.
set_showContentDuringLoadSets a value indicating whether the page that is loaded in the RadWindow should be shown during the loading process or when it has finished loading.
set_statusSets the message in the status area of the RadWindow .
set_titleSets the RadWindow's title. Note that if the content page has its own title set in the @Page directive or in the section, this title will override the RadWindow's declaratively configured one.
set_topSets the vertical offset relative to its offset element in pixels. Corresponds to the Top server property.
set_visibleStatusbarSets the visibility of the RadWindow's status bar. Accepts True / False as its parameter.
set_visibleTitlebarSets the visibility of the RadWindow's titlebar. Accepts True / False as its parameter.
set_widthSets the RadWindow's width in pixels.

Methods that Check a Condition or Invoke a Certain Behavior

Methods that check a condition or invoke a certain behavior.

NameDescription
addShortcutAdds the specified shortcut string to the given command. Takes two string parameters: the command and its shortcut.
autoSizeChanges RadWindow's size to fit the content page. You cannot use the autoSize method with pages from other domains due to browsers' security restrictions. You can optionally call the autoSize method with an argument set to true . This will make the autosizing perform an animation while adjusting the size.
centerCenters the RadWindow in the middle of the page (or its restriction zone if set).
closeCloses the RadWindow . Must be called from a RadWindow object, not from the window object when in a content page. You can pass an argument to it that is easily obtained from the main page. See this article for details.
getShortcutStringReturns the last shortcut for the command that is passed as an argument (string).
getWindowBoundsReturns the size and position of the RadWindow . For example: var bounds = oWnd.getWindowBounds(); bounds.x; //returns the current left position of the RadWindow; bounds.y; //returns the current top position of the RadWindow; bounds.height; //returns the current height of the RadWindow; bounds.width; //returns the current width of the RadWindow
hideMakes the RadWindow invisible.
isActiveReturns True if the RadWindow is the currently active one.
isAutoSizeBehaviorEnabledIndicates whether a certain AutoSize behavior is enabled for the RadWindow . Takes an argument of type Telerik.Web.UI.WindowAutoSizeBehaviors and returns a Boolean value.
isBehaviorEnabledIndicates whether a certain behavior is enabled for the RadWindow . Takes an argument of type Telerik.Web.UI.WindowBehaviors and returns a Boolean value.
isClosedReturns True if the RadWindow is currently closed.
isCreatedIndicates whether the UI of the RadWindow is already created or not.
isInitialBehaviorEnabledIndicates whether a certain initial behavior is enabled for the RadWindow . Takes an argument of type Telerik.Web.UI.WindowBehaviors and returns a Boolean value.
isMaximizedReturns True if the RadWindow is currently maximized.
isMinimizedReturns True if the RadWindow is currently minimized.
isModalReturns True if the RadWindow is modal.
isPinnedReturns True if the RadWindow is currently pinned.
isShortcutAddedReturns True if there is a shortcut added to the command. The command name is passed as a string argument.
isVisibleReturns True if the RadWindow is currently visible.
maximizeMaximizes the RadWindow .
minimizeMinimizes the RadWindow .
moveToSets the position of the RadWindow in pixels. Takes two integer arguments: Left and Top (in this order).
reloadReloads the content page in the RadWindow . The page should come from the same server as the parent page due to JavaScript's cross-site scripting limitations.
restoreRestores the RadWindow to its normal (non-minimized) state.
removeAllShortcutsCommandClears all shortcuts for the given command (passed as a string parameter).
removeShortcutRemoves the last shortcut for thegiven command (passed as a string parameter).
setActiveTakes a Boolean argument that, if true , makes the RadWindow the active (topmost) window on the page, otherwise when the passed parameter is false , the setActive method makes the control lose focus.
setSizeSets the size of the RadWindow in pixels. Takes two integer arguments for the width and height (in this order).
setUrlChanges the URL of the RadWindow. It will load the content page and create the markup of the dialog even if it has not been shown yet. To simply set the page without navigating to it, use set_navigateUrl.
showShows the RadWindow if it was invisible. If it does not exist, show() creates it.
togglePinToggles whether the RadWindow is pinned.

Methods for Modifying Client-side Event Handlers Dynamically

Methods for modifying client-side event handlers dynamically.

NameDescription
add_activateAdds a function that will be called when a RadWindow is activated. The name of this function can also be declared in the OnClientActivate property.
add_autoSizeEndAdds a function that will be called when a RadWindow has finished resizing when the AutoSize functionality has taken effect. The name of this function can also be declared in the OnClientAutoSizeEnd property.
add_beforeCloseAdds a function that will be called before RadWindow is closed. You can cancel the closing of RadWindow there by using set_cancel(true) . The name of this function can also be declared in the OnClientBeforeClose property.
add_beforeShowAdds a function that will be called before RadWindow is shown. You can cancel the closing of RadWindow there by using set_cancel(true) . The name of this function can also be declared in the OnClientBeforeShow property.
add_closeAdds a function that will be called when a RadWindow is closed. The name of this function can also be declared in the OnClientClose property.
add_commandTAdds a function that will be called when the commands Pin, Reload, Minimize and Maximize are executed (when the user presses a titlebar button). The name of this function can also be declared in the OnClientCommand property.
add_dragEndAdds a function that will be called when the user has finished dragging a RadWindow. The name of this function can also be declared in the OnClientDragEnd property
add_dragStartAdds a function that will be called when the user starts dragging a RadWindow. The name of this function can also be declared in the OnClientDragStart property.
add_pageLoadAdds a function that will be called when a RadWindow's content page is fully loaded. The name of this function can also be declared in the OnClientPageLoad property.
add_resizeAdds a function that will be called when the RadWindow is being resized. The name of this function can also be set in the OnClientResize property.
add_resizeEndAdds a function that will be called when the RadWindow is resized. The name of this function can also be set in the OnClientResizeEnd property.
add_resizeStartAdds a function that will be called when the RadWindow resizing is started. The name of this function can also be set in the OnClientResizeStart property.
add_showAdds a function that will be called when a RadWindow is shown. The name of this function can also be set in the OnClientShow property.
remove_activateRemoves a function declared with the add_activate function.
remove_autoSizeEndRemoves a function declared with the add_autoSizeEnd function.
remove_beforeCloseRemoves a function declared with the add_beforeclose function.
remove_beforeShowRemoves a function declared with the add_beforeShow function.
remove_closeRemoves a function declared with the add_close function
remove_commandRemoves a function declared with the add_command function
remove_dragEndRemoves a function declared with the add_dragEnd function.
remove_dragStartRemoves a function declared with the add_dragStart function.
remove_pageLoadRemoves a function declared with the add_pageLoad function.
remove_resizeRemoves a function declared with the add_resize function.
remove_resizeEndRemoves a function declared with the add_resizeEnd function.
remove_resizeStartRemoves a function declared with the add_resizeStart function.
remove_showRemoves a function declared with the add_show function.

See the Setting Client Event Handlers by Using JavaScript article for an example that shows how to set client event-handlers.

Examples

JavaScript
// UseRadWindow shows how to get a reference to a RadWindow
// and use it to call various methods.
function UseRadWindow()
{
	var oWnd = $find("<%= DialogWindow.ClientID %>");
	oWnd.show();
	oWnd.setSize(400, 400);
	oWnd.setUrl("http://www.yahoo.com");
	oWnd.minimize();
	oWnd.maximize();
	oWnd.restore();
}
// ShowWindow illustrates another way to get a reference
// to a RadWindow and set properties based on UI elements.
function ShowWindow()
{
	var manager = GetRadWindowManager();
	// txtShowWindow is the id of a textarea on the page.
	var txtShowWindow = document.getElementById("txtShowWindow");
	var window1 = manager.getWindowByName("RadWindow1");
	window1.setUrl(txtShowWindow.value);
	window1.set_title(txtShowWindow.value);
	window1.show();
}

//Open a RadWindow and set a function to be called
//when the RadWindow is closed.
function openWindow()
{
	//Get a reference to the window.
	var oWnd = $find("<%= RadWindow1.ClientID %>");
	//Set its NavigateUrl.
	oWnd.setUrl("https://www.telerik.com");
	//Add the name of the function to be executed when RadWindow is closed.
	oWnd.add_close(OnClientClose);
	//Show the window.
	oWnd.show();
}
function OnClientClose(oWnd, eventArgs)
{
	//Your code here.
	//Remove the OnClientClose function to avoid
	//adding it for a second time when the window is shown again.
	oWnd.remove_close(OnClientClose);
}

See Also