RadWindow autosize problem

8 posts, 0 answers
  1. phuc
    phuc avatar
    4 posts
    Member since:
    Jul 2011

    Posted 01 Jul 2011 Link to this post

    I have a RadWindow (contents are html not iframe):

    <telerik:RadWindow ID="radwindow1" VisibleTitlebar="false" VisibleStatusbar="false"<br>        BorderWidth="0" Title="Image" runat="server" VisibleOnPageLoad="false" Modal="true"<br>        Autosize="true"><br>        <contenttemplate>                  <br>            <img alt="" id="image1" />          <br>        </contenttemplate><br>    </telerik:RadWindow>


    The image1 size is unknown, it can be any size. Click a button will open radwindow1 using javascript:
    var oWnd = $find('<%=radwindow1.ClientID %>');<br>        if (oWnd) {            <br>            oWnd.autoSize(true);<br>            oWnd.show();<br>}

    It works fine on Firefox but not in IE 8. First time open it on IE 8 will work fine but next time will show pop up with scroll bars, then next time will be fine and next time not.

    My doctype:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    Thank for your time!
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4529 posts

    Posted 01 Jul 2011 Link to this post

    Hi Phuc,

    The AutoSize functionality depends on the content of the RadWindow having explicit dimensions set in pixels. If they are not present you may get some unexpected behavior, or it may sometimes work correctly.

    What I would recommend is that you add a handler to the load event of the image and invoke the autoSize() function explicitly. I believe you may find the following thread useful in the matter: http://www.telerik.com/community/forums/aspnet-ajax/window/problem-with-center-window-after-autosize.aspx as this approach is used there.


    Best wishes,
    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. phuc
    phuc avatar
    4 posts
    Member since:
    Jul 2011

    Posted 06 Jul 2011 Link to this post

    I tried your suggestion but no luck, I'll try to send you a simple project that include my problem, thank!
  4. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4529 posts

    Posted 07 Jul 2011 Link to this post

    Hi Phuc,

    I am sorry to hear that the solution from the other thread did not work for you.

    Take your own time and isolate your case in a simple, runnable project  that we can debug. When you are done please open a support ticket and send it back to us and we will examine it right away.


    All the best,
    Marin
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  5. Michael
    Michael avatar
    31 posts
    Member since:
    Dec 2011

    Posted 29 Dec 2011 Link to this post

    Hey, I have been trying to get the autosize feature working and finally found this thread.  Based on the information given by Marin above I am lead to believe that i would need to explicitly specify the sizes of my content within the rad window? Surely this would defeat the point of using the auto size property on the rad window? 

    Thanks,
    Michael


  6. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 03 Jan 2012 Link to this post

    Hi Michael,

    The AutoSize property is not intended to resize the content inside the RadWindow but to resize the RadWindow according to the inside content. If there is not a single size in your content, it is not possible to understand how to fit the content - e.g with a large width or large height, etc. That is why there should be at least one element inside the content of the RadWindow to instruct on how to resize. Most often it is not needed to explicitly set it but it depends a lot on what is the content itself. As you understand, the RadWindow is only the container and it should not determine the size of the content but the content should determine the container size when AutoSize is used.

    Please, examine the demo below and test the settings explained in it:

    http://demos.telerik.com/aspnet-ajax/window/examples/autosize/defaultcs.aspx


    In case you face a problem with your particular case (this will work out of the box in most cases), prepare a simple, fully runnable demo, open a support ticket and send it to us along with detailed explanations and we will help you achieve what you need so that you will be then able to apply the same logic in your original application. 

    All the best,
    Svetlina Anati
    the Telerik team
    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 their blog feed now
  7. Michael
    Michael avatar
    31 posts
    Member since:
    Dec 2011

    Posted 03 Jan 2012 Link to this post

    Our current situation is that we have A DIV element which floats above the other controls on the page when a user clicks a button (similar to a rad window).  In this window we have a few options and menus for the user to select.  When the user selects certain items/values a few more input controls  (drop down lists and text boxers)  may appear and allow them to input more information.  Our current div/floating window works Ok and expands as we expect it but it doesn't blend in very well with the rest of the telerik controls.  When using the rad window it stays exactly the same size as initially opened and presents us with little scroll bars to see the additional inputs.

    If you see the below two screen snippets.  The first shows the initial size, the second shows the size once some options have been selected. Its only the window titled "add rules" the background is the rest of the page.  I don't have any screenshots with the RadWindow as once I found it didn't work i removed the code. Unfortunately, I cannot share the current code however, if you still believe it is required I can create an example project.

    Thanks,
    Michael
  8. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 04 Jan 2012 Link to this post

    Hello Michael,

    As far as I understood from your explanations, the RadWindow autosizes fine when it is initially opened. After that you change the size of the content and the RadWindow stays the same size. This is the correct behavior by design - the RadWindow automatically autosizes when it is opened. To make it autosize again explicitly, you should call its method autoSize when you change the content size. The autoSize method is documented below:

    http://www.telerik.com/help/aspnet-ajax/window-programming-radwindow-methods.html

    and you can make the make the RadWindow autosize itself with an animation or not, controlling that with an input parameter.

    In addition, you can see this in action in our online demo below:

    http://demos.telerik.com/aspnet-ajax/window/examples/dialogreturnvalue/defaultcs.aspx

    When you open the RadWindow and you show the calendar dropdown, the RadWindow autosizes itself. When the calendar dropdown is hidden, the window autosize back to the changed size.

    Please, examine the provided resources and use the suggested approach. In case you still experience problem, please share sample demo page - there is no need to show your actual content, just put the same elements and logic - e.g DIV, random strings, etc since the content information, databases, etc itself is not what matters in the case but the layout configuration. 

    All the best,
    Svetlina Anati
    the Telerik team
    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 their blog feed now
Back to Top