RadWindow Appears and disappears

4 posts, 0 answers
  1. Dobre
    Dobre avatar
    3 posts
    Member since:
    Jul 2012

    Posted 27 Jun 2013 Link to this post

    I have the following situation:

    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" EnablePartialRendering="true">
                <%--Framework scripts--%>
               <asp:ScriptReference Name="MsAjaxBundle" />
     <telerik:RadWindowManager ID="RadWindowManagerL" runat="server" AnimationDuration="3000" EnableViewState="false"> </telerik:RadWindowManager>

     <asp:UpdatePanel ID="UP" runat="server">
                     <asp:ContentPlaceHolder runat="server" ID="MainContent" />

    <asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server"> <%-- this is the content that is placed in the UpdatePanel -->
    <asp:Button ID="btneditc" runat="server" Width="40px" Text="Edit" Font-Size="Small" Height="28px" BorderColor="#043C77" ForeColor="#043C77"  />
    <script type="text/javascript">
       function show(nameRadWindow) {
                        var name= String(nameRadWindow);
                        var manager = GetRadWindowManager();
                        var window = manager.getWindowByName(name);

    Public Class somename
        Inherits System.Web.UI.Page
        Dim IsFirstTime As Boolean = True
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
                   If (Not IsPostBack) And IsFirstTime = True Then                    
    IsFirstTime = False
    End if

    Public Sub createWin() 
     Dim numFer As Integer = DirectCast(Me.Master.FindControl("RadWindowManagerL"), RadWindowManager).Windows.Count()
                If numFer <> 0 Then
                    DirectCast(Me.Master.FindControl("RadWindowManagerL"), RadWindowManager).Windows.Clear()
                End If
            Catch ex As Exception

            End Try
            Dim arrayWindow(3, 4) As String

            arrayWindow(0, 0) = "radWindowOne" 
            arrayWindow(1, 0) = "windowOne.aspx" 
            arrayWindow(2, 0) = "Window One Title" '
            arrayWindow(3, 0) = "divname

            arrayWindow(0, 1) = "radWIndowTwo" 
            arrayWindow(1, 1) = "windowTwo.aspx" 
            arrayWindow(2, 1) = "Window two Title" 
            arrayWindow(3, 1) = "divname"

            arrayWindow(0, 2) = "radWindowThree" 
            arrayWindow(1, 2) = "windowThree.aspx" 
            arrayWindow(2, 2) = "Window Three Title" 
            arrayWindow(3, 2) = "divname"

            arrayWindow(0, 3) = "radWindowFour"
            arrayWindow(1, 3) = "windowFour.aspx" 
            arrayWindow(2, 3) = "Window Four Title" 
            arrayWindow(3, 3) = "divname"

            arrayWindow(0, 4) = "radWindowFive" 
            arrayWindow(1, 4) = "windowFive.aspx" 
            arrayWindow(2, 4) = "Window Five Title"  
            arrayWindow(3, 4) = "divname"    

            For i As Integer = 0 To 4
                Dim window As New Telerik.Web.UI.RadWindow()
                With window
                    .ID = arrayWindow(0, i)
                    .NavigateUrl = arrayWindow(1, i)
                    .Title = arrayWindow(2, i)
                    .RestrictionZoneID = arrayWindow(3, i)

                    .EnableViewState = False
                    .VisibleOnPageLoad = False
                    .ReloadOnShow = False
                    .ShowContentDuringLoad = False
                    .DestroyOnClose = False
                    .Behaviors = WindowBehaviors.Move Or WindowBehaviors.Close Or WindowBehaviors.Resize
                    .VisibleStatusbar = False
                    .Modal = True
                    .Skin = "Metro"
                    .EnableEmbeddedSkins = False
                    .Height = 440
                    .Width = 750
                End With

                DirectCast(Me.Master.FindControl("RadWindowManagerlocatii"), RadWindowManager).Windows.Add(window)
    ' All the windows are succesfully added
    End Sub

     Protected Sub btneditc_Click(sender As Object, e As EventArgs) Handles btneditc.Click
            'ScriptManager.RegisterStartupScript(Me, Me.GetType(), "openWnd", "show('radWindowOne'); return false;", True)
            'ScriptManager.RegisterStartupScript(Me, Me.GetType(), "openWnd", "show('radWindowFive'); return false;", True)
    ' If i try to open Window one, all things are ok the window is opened and doesn`t disappear
    ' if I try to open Window five , the window appears for 1 sec and disappears

        End Sub

    The code for WindowOne.aspx/vb and WindowFive.aspx/vb is the same
    I tried to call the JS function show() from aspx too : OnClientClick="show('nameofthewindow'); return false;" but doesn t work :( and I can't use RadScriptManager and AJAX because in somename.aspx a have a lot of UI oject (radgrids, etc...)

  2. Marin Bratanov
    Marin Bratanov avatar
    3555 posts

    Posted 28 Jun 2013 Link to this post

    Hello Dobre,

    A RadWindow would show and immediately hide if a postback disposed it, and since the provided declaration does not add differences between the first and the fifth popup the difference must be somewhere else on the page.

    What I can also suggest is trying to add these RadWindows declaratively in the manager instead of dynamically in the code-behind to see if this will make a difference.

    I would also strongly advise against using the "window" name for a variable name in your scripts, as it is s reserved variable for the browser window object. To open a popup you can simply call radopen() and set properties for the control afterwards if needed. You can set common settings for the manager (restriction zone, reloadOnShow, etc.) to have all its children inherit them automatically.

    Since you are working with scripts called from the server I also advise you examine the following resources on using the Sys.Application.Load event to ensure they are not executed too early:

    Marin Bratanov
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. DevCraft R3 2016 release webinar banner
  4. Dobre
    Dobre avatar
    3 posts
    Member since:
    Jul 2012

    Posted 02 Jul 2013 Link to this post

    So I tried this:

     <telerik:RadWindowManager ID="RadWindowManagerlocatii" runat="server" AnimationDuration="3000" EnableViewState="false" VisibleOnPageLoad ="False" ReloadOnShow="true" ShowContentDuringLoad="false" DestroyOnClose="false" Behaviors="Close" VisibleStatusbar="false" Modal="true" Skin="Metro" EnableEmbeddedSkins="false" Height ="440" Width="750">   
                    <telerik:RadWindow ID="radWindowAutoConf" runat="server" Title="Auto Configurare"></telerik:RadWindow>
                    <telerik:RadWindow ID="radWindowEdit" runat="server" Title="Editare Contoare"></telerik:RadWindow>

     <asp:Button ID="btnsave1" runat="server" OnClick="Button1_Click" />
          <asp:Button ID="btnsave2" runat="server" OnClick="Button2_Click" />

    <script type="text/js">
                    function showautoconfig() {
                        var manager = GetRadWindowManager();
                        manager.open("autoconf.aspx", "radWindowEdit");
    function showedit() {
                        var manager = GetRadWindowManager();
                        manager.open("edit.aspx", "radWindowAutoConf");

    somnename.aspx.vb :
    Protected Sub Button1_Click(sender As Object, e As EventArgs)
          ScriptManager.RegisterStartupScript(Me, Me.GetType(), "openWndAutoconfig", "showedit(); return false;", True  ) 
    End Sub
    Protected Sub Button2_Click(sender As Object, e As EventArgs)
          ScriptManager.RegisterStartupScript(Me, Me.GetType(), "openWndAutoconfig", "showautoconfig(); return false;", True  ) 
    End Sub

    <%@ Master Language="VB" AutoEventWireup="false" CodeBehind="Site_windows.Master.vb" Inherits="Energsys.Site_windows" %>

    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <link href="Content/contor.css" rel="stylesheet" />
    <link href="Content/filtrelocatii.css" rel="stylesheet" />
    <link href="Content/filtrelocmasura.css" rel="stylesheet" />
    <link href="Content/filtregrup.css" rel="stylesheet" />
    <link href="Content/addgrup.css" rel="stylesheet" />
    <link href="Content/istoricpm.css" rel="stylesheet" />
    <link href="Content/schimbareml.css" rel="stylesheet" />
    <link href="Content/Site_windows.css" rel="stylesheet" />
    <link href="Content/autoconfig.css" rel="stylesheet" />
    <script src="Scripts/closePopUpWindows.js"></script>

    <!DOCTYPE html>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <asp:ContentPlaceHolder ID="head" runat="server">
        <form id="editcontor" runat="server">
            <asp:scriptmanager ID="ScriptManagereditcontor" runat="server"></asp:scriptmanager>
            <section class="content-wrapper main-content clear-fix">
                <asp:UpdatePanel ID="UP1" runat="server">
                        <asp:ContentPlaceHolder runat="server" ID="MainContent" />


    autoconf.aspx: empty
    edit.aspx: empty
    edit.aspx.vb and autoconf.aspx.vb are empty

    All the things are the same: when i press button 1 the window appears and it's ok, when i press button 2 it appears and the page is refreshed and disappears. I really don't understand why, the windows are the same.
  5. Marin Bratanov
    Marin Bratanov avatar
    3555 posts

    Posted 03 Jul 2013 Link to this post


    I tried this code and it is working fine with me. You can find attached my test pages and a short video as a reference. At this point I can advise that you compare your setup with mine to see what is the difference that causes the problem. A possible reason for the RadWindow to close can also be a call to window.close() or GetRadWindow().close() from the page inside. Such a script can be present if an external script file is referenced there.

    Marin Bratanov
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top