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

Getting a specific window on top

3 Answers 122 Views
Window
This is a migrated thread and some comments may be shown as answers.
Stuart Hemming
Top achievements
Rank 2
Stuart Hemming asked on 14 Oct 2009, 06:19 PM
I have a masterpage with a RadWindowManger on it and a window defined within it.

I have a page (WebForm1), based on that master page that opens a modal window using a locally defined RadWindowManager.

The window that opens from WebForm1.aspx uses another page, WebForm2.aspx for its content.

WenForm2 includes some JavaScript that finds the browser window and calls JavaScript on the master page that opens a 2nd window.

Both the 1st and 2nd windows are opened modally.

When I run the code and open the 2nd window it opens below the 1st window and whilst the modal screen appears.

I want to be able to invoke the 2nd window and have the modal screen cover the 1st screen as well as the base page. I don't want the user to be able to interact with the first window whilst the 2nd is open.

Is this possible?

Below is the code I'm using...
Site1.master
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="TestBed.Site1" %> 
 
<%@ 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"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"
    <title></title
    <asp:ContentPlaceHolder ID="head" runat="server"
    </asp:ContentPlaceHolder> 
</head> 
<body> 
    <form id="form1" runat="server"
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
    </telerik:RadScriptManager> 
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"
      <script type="text/javascript"
        function OpenPopup() { 
          var wnd = $find("<%=Popup.ClientID %>"); 
          wnd.show(); 
        } 
      </script> 
    </telerik:RadScriptBlock> 
     
     
    <div> 
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"
         
        </asp:ContentPlaceHolder> 
    </div> 
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="WebBlue"
      <Windows> 
       <telerik:RadWindow ID="Popup" runat="server"  
        Animation="None"  
        Width="400px" 
        Height="400px" 
        VisibleStatusbar="false" 
        NavigateUrl="http://www.google.com" 
        KeepInScreenBounds="true" 
        Modal="true"></telerik:RadWindow> 
      </Windows> 
    </telerik:RadWindowManager> 
    </form> 
</body> 
</html> 

WebForm1.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="TestBed.WebForm2" %> 
 
<%@ 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"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"
    <title></title
</head> 
<body> 
    <form id="form1" runat="server"
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
    </telerik:RadScriptManager> 
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"
      <script type="text/javascript"
        function GetRadWindow() { 
          var oWindow = null
          if (window.radWindow) 
            oWindow = window.radWindow; 
          else if (window.frameElement.radWindow) 
            oWindow = window.frameElement.radWindow; 
          return oWindow; 
        } 
        function OpenPopup() { 
          var wnd = GetRadWindow().BrowserWindow; 
          wnd.OpenPopup(); 
        } 
      </script> 
     
    </telerik:RadScriptBlock> 
      <asp:Button runat="server" ID="btn2" Text="Click" OnClientClick="OpenPopup(); return false;" /> 
     
    </form> 
</body> 
</html> 
 

WebForm2.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="TestBed.WebForm1" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"
  <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"
    <script type="text/javascript"
      function Click() { 
        radopen(null, 'RadWindow1'); 
      } 
    </script> 
   
  </telerik:RadScriptBlock> 
 
 
  <asp:Button ID="btn" runat="server" Text="Click" OnClientClick="Click(); return false;" /> 
 
  <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="WebBlue"
    <Windows> 
      <telerik:RadWindow ID="RadWindow1" runat="server"  
        Animation="None"  
        Width="600px" 
        Height="100px" 
        VisibleStatusbar="false" 
        Left="50px"  
        Top="50px" 
        NavigateUrl="WebForm2.aspx" 
        KeepInScreenBounds="true" 
        Modal="true"
  </telerik:RadWindow> 
 
 
    </Windows> 
  </telerik:RadWindowManager> 
</asp:Content> 

I'd be grateful for any clues.

Thanks in advance.

--
Stuart


3 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Tunev
Telerik team
answered on 15 Oct 2009, 08:32 AM
Hello Stuart,

Try calling setActive(true) for the second RadWindow with a small timeout.

I hope this helps.


Sincerely yours,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Stuart Hemming
Top achievements
Rank 2
answered on 15 Oct 2009, 08:35 AM
You beat me to it by seconds; I was just about to post that I'd found the answer!

Thanks anyway.

--
Stuart
0
Stuart Hemming
Top achievements
Rank 2
answered on 15 Oct 2009, 07:57 PM
Initially, I was opening the 2nd popup via a button that posted back to the server, did some 'stuff' then called the function to open the window via ResponseScripts. This worked fine, but when I was able to get rid of the server-side code and call the function to open the popup directly, I had to put the timeout in that Georgi  suggested.

--
Stuart
Tags
Window
Asked by
Stuart Hemming
Top achievements
Rank 2
Answers by
Georgi Tunev
Telerik team
Stuart Hemming
Top achievements
Rank 2
Share this question
or