Rate this demo

Thank you for your post!
Submit a support ticket
If you have an active license or trial, you have access to dedicated support from Telerik’s developers. Response time is 24h for active licenses and 72h for trials, Mon-Fri.
Post in the forums
If you don’t have access to support or would like to help other people by sharing your problem, reach out to our active community in the forums.

Window - Return Values from a Dialog

This demo contains 1 or more dialog pages. To view them, hover over the dropdown button () in the Example Source Code & Description section

Click the button to open the Travel Planner form in a RadWindow.

 Travel Planner

This RadWindow example demonstrates a common real-world scenario - opening ASP.NET dialog from another dialog and ensuring the communication between them and the parent page.

In this particular example, a new RadWindow is opened from within another RadWindow in the context of the parent page. To build the communication between the popups and the parent page, we use RadWindow's client-side API. The following methods and properties are used:
  • BrowserWindow - this property returns a reference to the parent page from which the RadWindow was opened.
  • get_contentFrame() - this method returns a reference to the IFRAME, in which the content page of the RadWindow is displayed. To gain access to the content page itself, you need to use its contentWindow property, e.g.
  • When the initial RadWindow is closed, the argument from within it is transferred to the parent page in the close() function and is read in the OnClientClose function on the parent page.

You may also find useful the Creating parent-child relationships between RadWindows and passing data between them Code Library entry that extends this approach to use more dialogs through an interface-like collection of common scripts.

Show code in new window Demo isolation steps
<%@ Page Language="C#"  %>

<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
<html xmlns=''>
<head runat="server">
    <title>Passing value from ASP.NET Modal Dialog to parent page | RadWindow</title>
     <link href="stylesDefault.css" rel="stylesheet" type="text/css" />
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="true" />
    <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" />
     <qsf:InformationBox ID="InformationBox1" runat="server">
          <span style="font-size: 12px;">This demo contains 1 or more dialog pages. To view them,
               hover over the dropdown button (<span class="qsfExpandImage">&#9660;</span>) in
               the <em>Example
                Source Code &amp; Description</em> section</span>
     <script type="text/javascript">
          function openWin() {
               var oWnd = radopen("Dialog1.aspx", "RadWindow1");

          function OnClientClose(oWnd, args) {
               //get the transferred arguments
               var arg = args.get_argument();
               if (arg) {
                    var cityName = arg.cityName;
                    var seldate = arg.selDate;
                    $get("order").innerHTML = "You chose to fly to <strong>" + cityName + "</strong> on <strong>" + seldate + "</strong>";
          function autoSizeWithCalendar(oWindow) {
               var iframe = oWindow.get_contentFrame();
               var body = iframe.contentWindow.document.body;

               var height = body.scrollHeight;
               var width = body.scrollWidth;

               var iframeBounds = $telerik.getBounds(iframe);
               var heightDelta = height - iframeBounds.height;
               var widthDelta = width - iframeBounds.width;

               if (heightDelta > 0) oWindow.set_height(oWindow.get_height() + heightDelta);
               if (widthDelta > 0) oWindow.set_width(oWindow.get_width() + widthDelta);
     <telerik:RadWindowManager ID="RadWindowManager1" ShowContentDuringLoad="false" VisibleStatusbar="false"
          ReloadOnShow="true" runat="server" EnableShadow="true">
               <telerik:RadWindow ID="RadWindow1" runat="server" Behaviors="Close" OnClientClose="OnClientClose"
                    NavigateUrl="Dialog1.aspx" OnClientAutoSizeEnd="autoSizeWithCalendar">
               <telerik:RadWindow ID="RadWindow2" runat="server" Width="650" Height="480" Modal="true"
     <div id="offsetElement" style="height: 400px; padding: 8px; background-color: #eee;">
               Click the button to open the Travel Planner form in a RadWindow.
          <button onclick="openWin(); return false;">
               Choose Destination and date</button>
          <div id="order" class="orderText">
          <br />
          <br />