Adjust aRadWindow

3 posts, 0 answers
  1. Bernard
    Bernard avatar
    41 posts
    Member since:
    Jun 2010

    Posted 05 May 2011 Link to this post

    Hello,
    When I open a Radwindow with "radopen" function and "autoSize",
    The first time the window is opened, It's Ok. but when I use the "Ok" button, there is some scroll which appears.

    Here is an example.

    Perhaps you can help me ?
    Manys thanks.
    Bernard

    Telerik.js
    <!--
    // Pop up
    var XPupVal_Ok = "XPup1";
    var XPupVal_Annuler = "XPup0";
    function XPupAdjust() 
        setTimeout(function(){XPupGetWin().autoSize(true)}, 500);
    }
    function XPupGetWin()
    {
        var oWindow = null;
        if (window.radWindow) oWindow = window.radWindow;
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
        return oWindow;
    }
      
    function XPupOk()
    {
        XPupGetWin().close(XPupVal_Ok);
    }
    function XPupAnnuler()
    {
        XPupGetWin().close(XPupVal_Annuler);
    }
    function XPupClose(sender, args)
    {
        if (args.get_argument() == XPupVal_Ok)
        {
            //some code
        };
    }
    -->

    Telerik_Main.aspx

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Telerik_Main.aspx.cs" Inherits="Xarc.Telerik_Main" %>
      
    <%@ Register Assembly="Telerik.Web.UI, Version=2010.3.1317.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">
    <head runat="server">
        <title>Page sans titre</title>
      
        <script type="text/javascript" src="Telerik.js"></script>
      
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
      
            <script type="text/javascript">
            function pageLoad() 
            {
      
            
            function ShowTelerik_Window()  
            {    
                                                                           
                function f()
                {
                    Sys.Application.remove_load(f);
                    window.radopen("Telerik_Window.aspx", "Telerik_Window");  
                }
                Sys.Application.add_load(f);
            }
            </script>
      
        </telerik:RadCodeBlock>
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <div>
            <telerik:RadToolBar ID="toolBar" runat="server" BackColor="White" Width="100%" AutoPostBack="True"
                OnButtonClick="toolBar_ButtonClick">
                <Items>
                    <telerik:RadToolBarButton runat="server" ToolTip="Window Open" Value="LOC" Text="OpenRadW">
                    </telerik:RadToolBarButton>
                </Items>
            </telerik:RadToolBar>
        </div>
        <telerik:RadWindowManager runat="server" RestrictionZoneID="offsetElement" ID="XPupWindowManager"
            EnableShadow="true" ShowOnTopWhenMaximized="False" Behavior="Default" InitialBehavior="None"
            OnClientClose="XPupClose" Behaviors="None" Modal="true">
        </telerik:RadWindowManager>
        </form>
    </body>
    </html>

    Telerik_Window.ASPX

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Telerik_Window.aspx.cs"
        Inherits="Xarc.Telerik_Window" %>
      
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <title>Page sans titre</title>
        <script type="text/javascript" src="Telerik.js"></script>
        <script type="text/javascript">
            function pageLoad() 
            {
                XPupAdjust(); 
            
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
        <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" />
        <div style="height: 142px; width: 496px">
            <table style="width: 100%;">
                <tr>
                    <td>
                        <asp:Label ID="LibLabel" runat="server"></asp:Label>
                    </td>
                    <td>
                        <asp:RequiredFieldValidator ID="RFV" runat="server" Display="Dynamic" ErrorMessage="Libellé obligatoire"
                            ControlToValidate="Lib" SetFocusOnError="True">*</asp:RequiredFieldValidator>
                    </td>
                    <td>
                        <asp:TextBox ID="Lib" runat="server" Width="336px"></asp:TextBox>
                    </td>
                </tr>
            </table>
            <br />
            <asp:Button ID="MnuOk" runat="server" ToolTip="Validez" Text="Ok" OnClick="MnuOk_Click">
            </asp:Button>
            <asp:CustomValidator ID="CustomValidatorGeneral" runat="server" ErrorMessage="*"
                Display="Dynamic" ForeColor="White"></asp:CustomValidator>
            <input id="AnnBt" type="button" value="Annuler" onclick="XPupAnnuler();" />
            <div>
                <asp:ValidationSummary ID="ValidationSummary" runat="server" Width="100%"></asp:ValidationSummary>
            </div>
        </div>
        </form>
    </body>
    </html>

    Telerik_Main.cs

    using System;
    using System.Collections;
    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 Telerik.Web.UI;
      
    namespace Xarc
    {
        public partial class Telerik_Main : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                //RadAjaxManager1.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(manager_AjaxRequest);
            }
            protected void toolBar_ButtonClick(object sender, Telerik.Web.UI.RadToolBarEventArgs e)
            {
                switch (e.Item.Value)
                {
                    case @"LOC":
                        ScriptManager.RegisterStartupScript(this, GetType(), @"ShowTelerik_Window", @"ShowTelerik_Window();", true);
                        break;
                };
            }
            protected void manager_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
            {
                try
                {
                      
                }
                catch (Exception err)
                {
                     
                }
            }
        }
    }

    Telerik_Window.cs

    using System;
    using System.Collections;
    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 Telerik.Web.UI;
      
    namespace Xarc
    {
        public partial class Telerik_Window : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
      
            }
      
            protected void MnuOk_Click(object sender, EventArgs e)
            {
      
            }
        }
    }
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4712 posts

    Posted 09 May 2011 Link to this post

    Hello Bernard,

    When you click the OK button the page inside the RadWindow is postback and thus the RadWindow needs to resize itself again. Its default width is 300 pixels and the page inside is 496. This is the reason why initially a scrollbar may appear before the window is resized (before the page is fully loaded).

    On my end even that is not visible, as you can see in the video from my experiment: http://screencast.com/t/62giFSnpz6aZ. The animation is observed while the window is being resized and then no scrollbars remain. Am I missing something? Is your issue different? If so please provide detailed reproduction steps and a more elaborate explanation on the exact problem.



    Greetings,
    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.

  3. Stéphane
    Stéphane avatar
    5 posts
    Member since:
    Sep 2012

    Posted 12 May 2011 Link to this post

    Hello Marin,
    Many thanks for answering. Obviously you have not the same behaviour.
    Perhaps because the environment:
    I don't understand. I'm going to find another way.
    Bye
    Bernard
Back to Top