This is a migrated thread and some comments may be shown as answers.

RadRotator resizing issue

2 Answers 161 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Effat
Top achievements
Rank 1
Effat asked on 12 Apr 2011, 10:01 AM
I have a RadRotator with RotatorType = "CoverFlow". It's width is set to 100%. I used the following code to resize it but it gives me the error: "Microsoft JScript runtime error: Object doesn't support this property or method" on rotatorElement.RadResize();  

var RadRotator1=<%= Rttr.ClientID %>;   
  window.onresize=function() 
  {   
     var rotatorElement = document.getElementById("<%= Rttr.ClientID %>");     
      rotatorElement.RadResize();   
   }

This is my ASPX code:

<table cellspacing="0" cellpadding="0" width="100%" style="table-layout: fixed">
        <tr>
            <td align="left">
                <telerik:RadRotator ID="Rttr" runat="server" Width="100%" ItemWidth="225" ScrollDirection="Left"
                    Height="285px" ItemHeight="165" ScrollDuration="500" FrameDuration="2000" RotatorType="FromCode"
                    InitialItemIndex="4" OnClientItemShown="OnClientItemShown" OnClientItemClicked="OnClientItemClicked"
                    CssClass="RemoveRotatorBorder">
                    <ItemTemplate>
                        <asp:Image ID="img1" runat="server" />
                    </ItemTemplate>
                </telerik:RadRotator>
                <telerik:RadCodeBlock ID="block1" runat="server">
                    <script type="text/javascript">
                        Telerik.Web.UI.RadRotatorAnimation.set_scrollAnimationOptions("<%= Rttr.ClientID %>",
                                            {
                                                reflectionHeight: 0.5, // The height of the reflection
                                                reflectionOpacity: 0.25
                                            }
                                        );
                    </script>
                </telerik:RadCodeBlock>
            </td>
        </tr>
    </table>

Can you please let me know what am I doing wrong and what can be done to fix the resizing issue??

2 Answers, 1 is accepted

Sort by
0
Accepted
Niko
Telerik team
answered on 13 Apr 2011, 02:27 PM
Hi Effat,

There is no official method in the client-side API to set the size of the RadRotator. Still you could change the size of the container element of the rotator. I see in your code that this is exactly what you are trying to accomplish. Still a regular DOM element doesn't have a RadResize method. What you need to do is change the style.width or style.height of the element. Please, make sure to set the values in pixels or any other metric system supported by CSS. Also there is a shortcut to document.getElementById - $get. Here is an example how to set things up:
window.onresize=function()
  {  
     var rotatorElement = $get("<%= Rttr.ClientID %>");    
      rotatorElement.style.width = "225px";
      rotatorElement.style.height= "285px";  
   }

Hope this helps.

All the best,
Niko
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.

0
Effat
Top achievements
Rank 1
answered on 19 Apr 2011, 08:49 AM
Thanks alot :)
Tags
Rotator
Asked by
Effat
Top achievements
Rank 1
Answers by
Niko
Telerik team
Effat
Top achievements
Rank 1
Share this question
or