New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Return Values from a Dialog

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.
    get_contentFrame().contentWindow.
  • 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.

  • DefaultVB.aspx
    • DefaultVB.aspx
    • Dialog1.aspx
    • Dialog2.aspx
  • scripts.js
    • scripts.js
    • scriptsDialog1.js
    • scriptsDialog2.js
  • styles.css
    • styles.css
    • stylesDialog1.css
    • stylesDialog2.css
  • CityInfo.xml
<%@ Page Language="vb"  %>

<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
    <script src="scripts.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadFormDecorator RenderMode="Lightweight" ID="RadFormDecorator1" runat="server" DecoratedControls="Buttons" />
    <telerik:RadWindowManager RenderMode="Lightweight" ID="RadWindowManager1" ShowContentDuringLoad="false" VisibleStatusbar="false"
        ReloadOnShow="true" runat="server" EnableShadow="true">
        <Windows>
            <telerik:RadWindow RenderMode="Lightweight" ID="RadWindow1" runat="server" Behaviors="Close" OnClientClose="OnClientClose"
                NavigateUrl="Dialog1.aspx" OnClientAutoSizeEnd="autoSizeWithCalendar">
            </telerik:RadWindow>
            <telerik:RadWindow RenderMode="Lightweight" ID="RadWindow2" runat="server" Width="650" Height="480" Modal="true" NavigateUrl="Dialog2.aspx">
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
    <div class="demo-container size-narrow">
        <p>
            Click the button to open the Travel Planner form in a RadWindow.
        </p>
        <button onclick="openWin('<%=GetCurrentSkin() %>'); return false;">
            Choose Destination and date</button>
        <div id="order" class="orderText">
            &nbsp;
        </div>
    </div>
<script runat="server">
    Protected Function GetCurrentSkin() As String
        Return RadSkinManager.GetCurrent(Page).Skin
    End Function
</script>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance