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

[Solved] Problem with radOpen on pageLoad

1 Answer 187 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Manuel Velazquez
Top achievements
Rank 1
Manuel Velazquez asked on 14 Aug 2009, 05:33 PM
Hi,

I hope anybody can help.

The telerik version is Q2 2009 asp radajax controls.

I have an outlook like interface an in one escenario I need to open a radwindow via radopen in the page load the escenario is as follows

1.- Open a capture page in a radpane
2.-Recover parameters from the capture.
3.- Open a new page 2 for register other tasks (this page use a parameters on string )
4.- when onpageload for page2 open a radopen pop to select options for the tasks of the page2.
The page2 has the structure
RadSCriptManager
RadaAJaxManager
RadWindowManager
Register ClienScriptStartup on page load
javascript function to open  the pop via radopen.

The problem is that when scirpt executes the javascript function to open the pop it cannot find the window and the radAjaxmanager,

DefaultPage.aspx.cs
using System;  
using System.Configuration;  
using System.Data;  
using System.Linq;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.HtmlControls;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Xml.Linq;  
using System.Text;  
 
public partial class _Default : System.Web.UI.Page   
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
        try 
        {  
             
                this.ClientScript.RegisterStartupScript(this.GetType(),  
                this.Page.ToString(),  
                GeneraScript(string.Format("Sys.Application.add_load(OpenWindowWH1('pruebaPop.aspx', 480, 485));", 1))  
                );  
             
        }  
        catch (Exception ex)  
        {   
              
        }  
    }  
 
 
 
    public static string GeneraScript(string codigo)  
    {  
        StringBuilder sbScript = new StringBuilder();  
        sbScript.AppendLine("<script type =\"text/javascript\">");  
        sbScript.AppendLine("<!--");  
        sbScript.AppendLine(codigo);  
        sbScript.AppendLine("//-->");  
        sbScript.AppendLine("</script>");  
 
        return sbScript.ToString();  
    }  
}  
 


Default.aspx
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %> 
 
<%@ Register Assembly="Telerik.Web.UI, Version=2009.2.701.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" 
    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>Untitled Page</title> 
      
      
    <script type="text/javascript" language="javascript">  
      
    <!--  
            
             function OpenWindowWH1(url, width, heigth) {  
               debugger;  
                     var oWindow = GetRadWindow();  
                       
                if(oWindow)  
                {  
                 oWindow.setUrl(url);  
                }  
                else  
                {  
                    oWindow = window.radopen(url, 'VentanaFlotanteUsr');  
                }  
 
                 
                //var oWindow = window.radopen(url, 'VentanaFlotanteUsr');  
                oWindow.set_visibleStatusbar(false);  
                oWindow.set_showContentDuringLoad(false);  
                oWindow.setSize(width, heigth);  
                oWindow.center();  
                oWindow.set_behaviors(4);  
                oWindow.set_modal(true);  
                oWindow.add_close(CierraUsuarios);  
 
            }  
            
          
          
    //--> 
    </script>      
      
</head> 
 
<body> 
    <form id="form1" runat="server">  
    <div> 
      
        <telerik:RadScriptManager ID="rdscrpAdm" runat="server"></telerik:RadScriptManager> 
    <telerik:RadAjaxManager  ID="RadAjaxManagerActividades" runat="server">  
    </telerik:RadAjaxManager> 
        <telerik:RadWindowManager ID="RadWindowManagerUsuarios" runat="server" > 
        <Windows> 
            <telerik:RadWindow ID="VentanaFlotanteUsr" runat="server"  Title="Seleccione usuario" Splash="false" VisibleOnPageLoad="false" Visible="true" Height="485px" Width="475px"  ReloadOnShow="true" Modal="true" Behavior="Pin,Close" OnClientClose="CierraUsuarios"  /> 
        </Windows>                                            
    </telerik:RadWindowManager> 
    </div> 
    </form> 
</body> 
</html> 
 


the pruebaPop.aspx is just a single aspx page with no controls for the test

I hope you can help me is very urgent for a customer

1 Answer, 1 is accepted

Sort by
0
Manuel Velazquez
Top achievements
Rank 1
answered on 14 Aug 2009, 07:39 PM

I manage to solve it thks to 

Georgi, Telerik
with his post

Calling radalert from codebehind (all versions of RadWindow)

string prueba = "function OpenWindowWH() {  var oWindow = window.radopen('SeleccionarActividad.aspx?Id=" + this.Page.Request.Params["IdUsr"] + "', 'VentanaFlotanteUsr'); Sys.Application.remove_load(OpenWindowWH2);}; Sys.Application.add_load(OpenWindowWH2);";  
            System.Web.UI.ScriptManager.RegisterStartupScript(thisthis.GetType(), "scriptpop",prueba, true); 
Tags
General Discussions
Asked by
Manuel Velazquez
Top achievements
Rank 1
Answers by
Manuel Velazquez
Top achievements
Rank 1
Share this question
or