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

Autostart the scroller?

4 Answers 47 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 16 Nov 2010, 10:22 AM
Hi - I am using a scroller with the client api to stop, start, letf and right the scroller content. This all works fine as per your demo but I need the scroller to be scrolling when it loads. In your example the user has to press play to start it but I want it to be playing by default.

How do I do this?

Thanks.

4 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 16 Nov 2010, 11:11 AM
Hello John,

 I assume that the demo you refer to is the following one:


http://demos.telerik.com/aspnet-ajax/rotator/examples/clientapicontrol/defaultcs.aspx

If so, the method which is called to start is startRotator and to have it automatically executed without pressing the button you should programmatically call it in the rotator's OnClientLoad event.

All the best,
Svetlina
the Telerik team
Browse the vast support resources we have to jumpstart 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
John
Top achievements
Rank 1
answered on 16 Nov 2010, 11:15 AM
Thanks - yes I tried this but don't think I quite got the code right.

I tried this:

OnClientLoad ="startRotator(this, $find('<%= RadRotator1.ClientID %>'), Telerik.Web.UI.RotatorScrollDirection.Left)"

but I changed "this" to the ID of the start button. But - this didn't work - the rotator was just blank.

Sorry - I'm doing something stupid here I know but just cant quite figure it out.

Any ideas? 

Thanks.
0
Accepted
Svetlina Anati
Telerik team
answered on 16 Nov 2010, 11:33 AM
Hi John,

 To achieve what you need I suggest to go through the following steps:


1) Set id to the link which represents the start button as shown below:

<ul id="navigationHorizontal" class="commandsWrapper">
                  <li><a href="#" onclick="stopRotator(this, $find('<%= RadRotatorHorizontal.ClientID %>')); return false;"
                      class="stopSelected" title="Stop"><span>Stop</span></a></li>
                  <li><a id="startButton" href="#" onclick="startRotator(this, $find('<%= RadRotatorHorizontal.ClientID %>'), Telerik.Web.UI.RotatorScrollDirection.Left); return false;"
                      class="start" title="Start"><span>Start</span></a></li>
                  <li><a href="#" onclick="showNextItem(this, $find('<%= RadRotatorHorizontal.ClientID %>'), Telerik.Web.UI.RotatorScrollDirection.Left); return false;"
                      class="left" title="Left"><span>Up</span></a></li>
                  <li><a href="#" onclick="showNextItem(this, $find('<%= RadRotatorHorizontal.ClientID %>'), Telerik.Web.UI.RotatorScrollDirection.Right); return false;"
                      class="right" title="Right"><span>Down</span></a></li>
              </ul>

2) Handle the OnClientLoad event as shown below:

<telerik:RadRotator ID="RadRotatorHorizontal" runat="server" DataSourceID="xmlDataSource1"
    Height="60px" Width="250px" ItemHeight="60px" ItemWidth="250px" RotatorType="FromCode"
    ScrollDirection="Left" CssClass="floatRotator" OnClientLoad="OnClientLoad">

3) Call the startRotator method method in the OnClientLoad handler as shown below:

function OnClientLoad(sender, args)
{
    startRotator($get("startButton"), sender, Telerik.Web.UI.RotatorScrollDirection.Left);
}

I hope that my reply is detailed enough and helpful, let me know how it goes.

Sincerely yours,
Svetlina
the Telerik team
Browse the vast support resources we have to jumpstart 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
John
Top achievements
Rank 1
answered on 16 Nov 2010, 11:38 AM
Perfect - thanks so much.
Tags
Rotator
Asked by
John
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
John
Top achievements
Rank 1
Share this question
or