RadWindow height problem

Thread is closed for posting
2 posts, 0 answers
  1. Dayana Maliyakal
    Dayana Maliyakal avatar
    27 posts
    Member since:
    Jan 2010

    Posted 05 May 2010 Link to this post

    I need to set the radwindow height as 100% to the form window in IE,Chrome,Mozilla.When I am using the following code the radwindow is displayed as an attached file. Please help me to solve this issue.



    Default.aspx page


    <%

    @ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default2" %>

     

    <%

    @ 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>

     

     

     

     

     

    <style type="text/css">

     

     

     

     

     

    html, body, form

     

     

     

     

    {

     

    height: 100%;

     

     

    width: 100%;

     

     

    margin: 0px;

     

     

    padding: 0px;

     

     

    overflow: hidden;

     

    }

     

    </style>

     

    </

     

    head>

     

    <

     

    body>

     

     

     

     

     

    <form id="form1" runat="server">

     

     

     

     

     

    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">

     

     

     

     

     

    </telerik:RadScriptManager>

     

     

     

     

     

    <script type="text/javascript">

     

     

     

     

     

    function onWindowResize(oWindow)

     

    {

    setWinSize(oWindow);

    }

     

    function setWinSize(oWindow) {

     

     

     

    var realBounds = $telerik.getBounds(oWindow.get_popupElement()); // The true size ;

     

     

     

     

     

    var contentFrame = oWindow.get_contentFrame();

     

    contentFrame.style.height = realBounds.height +

    "px"; // Set the true height ;

     

     

     

     

     

    if (realBounds.height < 150) {

     

    contentFrame.style.height = realBounds.height +

    "px"; // Set the true height ;

     

     

     

     

     

    }

     

    else {

     

    contentFrame.style.height =

    "100%";

     

     

    }

    }

     

     

    function OnClientShow(oWindow, args)

     

    {

    setWinSize(oWindow);

    }

     

    </script>

     

     

     

     

     

    <div>

     

     

     

     

     

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">

     

     

     

     

     

    <Windows>

     

     

     

     

     

    <telerik:RadWindow ID="RadWindow1" runat="server" Width="600" Height="800"

     

     

     

     

     

    KeepInScreenBounds="true" OnClientShow="OnClientShow" OnClientResize="onWindowResize" VisibleOnPageLoad="true"

     

     

     

     

     

    NavigateUrl="Popup.aspx">

     

     

     

     

     

    </telerik:RadWindow>

     

     

     

     

     

    </Windows>

     

     

     

     

     

    </telerik:RadWindowManager>

     

     

     

     

     

     

     

    </div>

     

     

     

     

     

    </form>

     

    </

     

    body>

     

    </

     

    html>

     

  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 06 May 2010 Link to this post

    Hello Dayana,

    Please, note that it is not recommended to set the size of the elements of a RadControl one by one - for such cases the controls offer public API which does what you need. In the case of RadWindow you should use set_height or setSize methods which are listed below:

    http://www.telerik.com/help/aspnet-ajax/window_programmingradwindowmethods.html

    What you should do is to calculate the desired size which is developer's task and not directly related to RadControls and then set the size to the RadWindow. One possible solution is to use the $telerik library e.g as shown below:

    <%@ Page Language="C#" %>
      
    <%@ 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>
        <style type="text/css">
            html, body, form
            {
                height: 100%;
                width: 100%;
                margin: 0px;
                padding: 0px;
                overflow: hidden;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="RadScriptManager1" runat="server">
        </asp:ScriptManager>
      
        <script type="text/javascript">
      
            function onWindowResize(oWindow)
            {
                setWinSize(oWindow);
            }
      
            function setWinSize(oWindow)
            {
                var bounds = $telerik.getViewPortSize();
                oWindow.set_height(bounds.height);
            }
            function OnClientShow(oWindow, args)
            {
                setWinSize(oWindow);
            }
      
        </script>
      
        <div>
            <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
                <Windows>
                    <telerik:RadWindow ID="RadWindow1" runat="server" Width="600" Height="800" KeepInScreenBounds="true"
                        OnClientShow="OnClientShow" OnClientResize="onWindowResize" VisibleOnPageLoad="true"
                        NavigateUrl="Popup.aspx">
                    </telerik:RadWindow>
                </Windows>
            </telerik:RadWindowManager>
        </div>
        </form>
    </body>
    </html>

    If I have not correctly understand you or you need further assistance, please provide more detailed explanations and I will do my best to help.

    Best wishes,
    Svetlina
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top