This is a migrated thread and some comments may be shown as answers.

Open Child RadWindow with code behind

1 Answer 60 Views
Window
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 02 Aug 2011, 04:32 PM
Hi, 

I would like to know if it's possible for a window (modal) to open another window modal as well.

Also, I tried multiple ways to open a window using server code but none seems to work if your window is used as a control container.

Here an example

I have this page :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Page1.aspx.cs" Inherits="RadWindowTest.Page1" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="Button1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <div>
        <asp:Label ID="lbl" runat="server" Text="PAGE 1" Font-Size="Larger"></asp:Label><br />
        <asp:Button ID="Button1" runat="server" Text="Show Second Window"
            onclick="Button1_Click" />
        <telerik:RadWindow ID="RadWindow1" runat="server"  runat="server" Behaviors="Close" DestroyOnClose="true" VisibleStatusbar="false" AutoSize="true" Modal="true">
            <ContentTemplate>
                <asp:DropDownList ID="DropDownList1" runat="server"></asp:DropDownList>
            </ContentTemplate>
        </telerik:RadWindow>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        </telerik:RadWindowManager>
    </div>
    </form>

     <script>
         function open() {
            /*
             var x = $find("<%= RadWindow1.ClientID %>");
             x.show();
             return false;
            */
         }
    </script>
</body>
</html>

Which open the window on the button click
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace RadWindowTest
{
    public partial class Page1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
 
        protected void Button1_Click(object sender, EventArgs e)
        {
            DropDownList1.Items.Add(new ListItem(DateTime.Now.ToShortDateString(), DateTime.Now.ToShortDateString()));
            RadWindowManager1.Windows.Add(RadWindow1);
//ClientScript.RegisterClientScriptBlock(this.GetType(), "open", "<script>open();</script>");
        }
    }
}


What am I missing here ?



1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 03 Aug 2011, 02:06 PM
Hi Eric,

I believe that this issue may be related to your other thread on the matter (Open Child Window Dynamically). Nevertheless I will paste here some links that contain useful information on the matter for others that may have a similar issue.

In order to open a RadWindow from another radwindow you would need to access the page where the first one is declared. If you are using the navigateUrl property please examine this help article to see how to do this. If you are using the ContentTemplate then the contents of the RadWIndow are already part of the main page and you can access them directly. This difference is shown in this online demo. The exact way to open a second RadWIndow is shown in this help article and you can also refer to this one for other ways to open a RadWindow. In the case where you need to do this from the code-behind I would recommend injecting a JavaScript function from the server to do the job, as the RadWindow is a client-side object and is best used with JavaScript. How to do this is explained in this help article.

I hope my reply was informative and the information provided in these links will help you resolve the situation.

Kind regards,
Marin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Window
Asked by
Eric
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or