Prevent autosize on post-back

2 posts, 0 answers
  1. ToltingColtAcres
    ToltingColtAcres avatar
    83 posts
    Member since:
    Nov 2010

    Posted 07 Feb 2014 Link to this post

    I am using autosize on several of my radwindows successfully.

    There are a few windows where I would like to have the window autosized when it loads, but after the initial load, disable autosize on further postbacks.

    I am running into a situation where I load a radgrid in a radwindow to display some data with filtering and sorting enabled. If the user specifies a filter criteria which yields no records, the radwindow resizes so small that they cannot "unfilter" because clicking the filter button again opens a list which disappears off the top and bottom of the 'resized' radwindow.

    By using autosize when the window first opens, I get a properly sized window. I'd like to be able to disable autosize after the window is opened so on future postbacks the window will not resize.

    I attempted to add this code to client-size scripting, but it had no effect. Can someone suggest a method by which I can accomplish this? Thanks, Mike.

    ​       function pageLoad() {
    var oWnd = null;
    if (window.radWindow)
    oWnd = window.radWindow;
    if (window.frameElement.radWindow)
    oWnd = window.frameElement.radWindow;
    if (oWnd) {
    window.setTimeout(function () { oWnd.autoSize(false); oWnd.set_autoSize(false); }, 500);
  2. Marin Bratanov
    Marin Bratanov avatar
    3567 posts

    Posted 10 Feb 2014 Link to this post


    Since you want autosizing only for the initial load I can suggest using the OnClientPageLoad event. Here are two ways you can have this done:
    - no automatic autosizing, manually autosize only when needed, e.g.:
    <telerik:RadWindow ID="RadWindow1" runat="server" AutoSize="false" OnClientPageLoad="OnClientPageLoad">
    <script type="text/javascript">
        function OnClientPageLoad(wnd) {
            //with animation
            //without animation:

    - OR, use autmatic autosizing, but disable it after the first time it autosizes:
    <telerik:RadWindow ID="RadWindow1" runat="server" AutoSize="true" OnClientAutoSizeEnd="OnClientAutoSizeEnd">
    <script type="text/javascript">
        function OnClientAutoSizeEnd(wnd) {

    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 UI for ASP.NET AJAX, subscribe to the blog feed now.
  3. DevCraft R3 2016 release webinar banner
Back to Top