Window - Size Limit

Demo Configurator

Set RadWindow's size properties
Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

The RadWindow now supports MaxWidth, MaxHeight, MinWidth and MinHeight properties - if they are set, when you resize it they will be respected

Note 1: There are default minimum width and height, determined by the icons in titlebar, etc and if we set less size, the visual appearance of the RadWindow is spoiled. That is why, if you set MinWidth or MinHeight less than them, the default absolute minimums will be set

Note 2: The AutoSize functionality respects the MaxWidth, MaxHeight, MinWidth and MinHeight properties.

Note 3: If you set Width(Height) bigger than the MaxWidth(MaxHeight) or less than MinWidth(MinHeight) you have set, the Width and Height properties will be modified in order to respect the set limits

Note 4: The client-side width and height setters respect the set limits

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • scripts.js
  • styles.css
<%@ Page AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.Web.Examples.Window.MinMaxSize.DefaultCS"Language="c#"  %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
    <script src="scripts.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="Button1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadWindow1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <div id="window-container" class="demo-container">
        <telerik:RadWindow RenderMode="Lightweight" ID="RadWindow1" runat="server"
            VisibleOnPageLoad="true"
            OffsetElementID="window-container"
            NavigateUrl="http://www.bing.com"
            OnClientShow="telerikDemo.centerWindowInOffsetElement">
        </telerik:RadWindow>
    </div>
    <qsf:ConfiguratorPanel runat="server" ID="ConfigurationPanel1">
        <Views>
            <qsf:View>
                <qsf:ConfiguratorColumn runat="server" Title="Set RadWindow's size properties" Size="Wide">
                    <ul class="fb-group">
                        <li>
                            <qsf:NumericTextBox Label="Width (px)" MinValue="0" AllowOutOfRangeAutoCorrect="true" NumberFormat-DecimalDigits="0"
                                runat="server" Size="Narrow" ID="Width" MaxValue="1500">
                            </qsf:NumericTextBox>
                            <qsf:NumericTextBox Label="Height (px)" MinValue="0" AllowOutOfRangeAutoCorrect="true" NumberFormat-DecimalDigits="0"
                                runat="server" Size="Narrow" ID="Height" MaxValue="1500">
                            </qsf:NumericTextBox>
                        </li>
                        <li>
                            <qsf:NumericTextBox Label="MaxWidth (px)" Size="Narrow" MinValue="0" AllowOutOfRangeAutoCorrect="true" NumberFormat-DecimalDigits="0"
                                runat="server" ID="MaxWidth" MaxValue="1500">
                            </qsf:NumericTextBox>
                            <qsf:NumericTextBox Label="MaxHeight (px)" Size="Narrow" MinValue="0" AllowOutOfRangeAutoCorrect="true" NumberFormat-DecimalDigits="0"
                                runat="server" ID="MaxHeight" MaxValue="1500">
                            </qsf:NumericTextBox>
                        </li>
                        <li>
                            <qsf:NumericTextBox Label="MinWidth (px)" Size="Narrow" MinValue="0" AllowOutOfRangeAutoCorrect="true" NumberFormat-DecimalDigits="0"
                                runat="server" ID="MinWidth" MaxValue="1500">
                            </qsf:NumericTextBox>
                            <qsf:NumericTextBox Label="MinHeight (px)" Size="Narrow" MinValue="0" AllowOutOfRangeAutoCorrect="true" NumberFormat-DecimalDigits="0"
                                runat="server" ID="MinHeight" MaxValue="1500">
                            </qsf:NumericTextBox>
                        </li>
                        <li>
                            <qsf:Button ID="Button1" runat="server" Text="Apply Configuration" Width="180px" OnClick="ConfigureRadWindow" Size="Wide" />
                        </li>
                    </ul>
                </qsf:ConfiguratorColumn>
            </qsf:View>
        </Views>
    </qsf:ConfiguratorPanel>
    </form>
</body>
</html>

Find Assistance

Help Us Improve

Was this example helpful?