RadRotator not resizing on browser resize

4 posts, 0 answers
  1. Ronan BARRANGER
    Ronan BARRANGER avatar
    24 posts
    Member since:
    Mar 2010

    Posted 15 Mar 2012 Link to this post

    Greetings,

    I'm currently trying to resize this control on browser resize.
    I tried to look on the forums before asking. I found a Javascript function ( which is not working unfortunately).

        <script type="text/javascript">
     
    window.onresize = function()    
    {    
        var rotatorElement = document.getElementById("ContentPlaceHolder1_RadRotator1" + "_Div");    
        rotatorElement.RadResize(); 
    }
     
    </script>

    Error : RadResize undefined.

    Thanks in advance for your help

  2. Slav
    Admin
    Slav avatar
    1356 posts

    Posted 19 Mar 2012 Link to this post

    Hello Ronan,

    You can resize the RadRotator control according to the browser window via additional client-side script and an Ajax request to the server. This is required because the size of the RadRotator's items should also be changed when the control is resized in order to preserve its proper functionality. The items of a RadRotator should always be configured to fit in its ViewPort as explained in this help article.

    You can find attached a sample page that implements the suggested approach and will help you incorporate this feature into your actual project.

    Kind regards,
    Slav
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Bertha
    Bertha avatar
    56 posts
    Member since:
    Aug 2012

    Posted 30 Jan 2013 Link to this post

    I want to use a simple solution as suggested in
    http://www.telerik.com/community/forums/aspnet-ajax/rotator/radrotator-resizing-issue.aspx

    window.onresize=function()
      {  
         var rotatorElement = $get("<%= Rttr.ClientID %>");    
          rotatorElement.style.width = "225px";
          rotatorElement.style.height= "285px";  
       }

    But why it is not working?  I used alert to check the style.width and it was set correctly. But the rotator was not refreshed.
  5. Slav
    Admin
    Slav avatar
    1356 posts

    Posted 01 Feb 2013 Link to this post

    Hello Bertha,

    Changing the size of the RadRotator on the client is not possible, because it will break the calculations that are performed when the items of the control are rotated. The solution that I would suggest is to make an AJAX request in order to update the size of the rotator and its items on the server. This approach is described in the Knowledge Base article Setting RadRotator's size in percent. Please use it as a reference for implementing the desired functionality in your actual project.

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