Autostart the scroller?

5 posts, 1 answers
  1. John
    John avatar
    34 posts
    Member since:
    Apr 2008

    Posted 16 Nov 2010 Link to this post

    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.
  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 16 Nov 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. John
    John avatar
    34 posts
    Member since:
    Apr 2008

    Posted 16 Nov 2010 Link to this post

    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.
  5. Answer
    Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 16 Nov 2010 Link to this post

    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.
  6. John
    John avatar
    34 posts
    Member since:
    Apr 2008

    Posted 16 Nov 2010 Link to this post

    Perfect - thanks so much.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017