Set Rotator intialItenIndex property using javascript

4 posts, 0 answers
  1. divya sahu
    divya sahu avatar
    16 posts
    Member since:
    Oct 2009

    Posted 08 Jun 2011 Link to this post

    Hi,

       I am using telerik rad rotator (dll licensed version : 2009.3.1208.20 )  in SharePoint 2010 site.I want to set rotator's IntialItemIndex property using javascript.Currently i have written following code server side to set rotator's IntialItemIndex :

     

     

     

     

    protected

     

    void SetInaitialItemIndex(object sender, EventArgs e)

     

     

    {

     

     

     

    try

     

     

     

     

     

     

     

     

    {

     

     

     

    LinkButton senderControl = sender as LinkButton;

     

     

     

     

    string indexAsString = senderControl.Text; // Get the value - it should be a number;

     

     

     

     

     

     

     

     

     

     

    int initialIndex = int.Parse(senderControl.Text);// Parse to int

     

     

     

     

     

     

     

     

    initialIndex = initialIndex - 1;

     

    BannerRotator.InitialItemIndex = initialIndex;

     

    // Assign the new value ;

     

     

     

     

     

     

     

     

    }

     

     

     

    catch (Exception oEx)

     

     

    {

     

     

     

    // HttpContext.Current.Response.Write("Set Inaitial Item Index :" + oEx.Message);

     

     

     

     

     

     

     

     

    }

     

    }

     

     

     

    I want to change above code logic in client side javascript,As i have 5 link buttons on my User control and i am calling above function(SetInaitialItemIndex) in linkbutton' onClick event like below.Also i have attached the screen shot of my web part as attachment.

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    <asp:LinkButton BorderWidth="0" ID="lnkbtn1" runat="server" Text="1" ForeColor="white" CssClass="prismimagelink" OnClick="SetInaitialItemIndex"></asp:LinkButton>

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    <asp:LinkButton BorderWidth="0" ID="lnkbtn2" runat="server" Text="2" ForeColor="white" CssClass="prismimagelink" OnClick="SetInaitialItemIndex"></asp:LinkButton

     

     

     

    >

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    <asp:LinkButton BorderWidth="0" ID="lnkbtn3" runat="server" Text="3" ForeColor="white" CssClass="prismimagelink" OnClick="SetInaitialItemIndex"></asp:LinkButton

     

     

     

    >

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    <asp:LinkButton BorderWidth="0" ID="lnkbtn4" runat="server" Text="4" ForeColor="white" CssClass="prismimagelink" OnClick="SetInaitialItemIndex"></asp:LinkButton

     

     

     

    >

     

     

     

     

     

     

     

     

     

     
    <asp:LinkButton BorderWidth="0" ID="lnkbtn5" runat="server" Text="5" ForeColor="white" CssClass="prismimagelink" OnClick="SetInaitialItemIndex"></asp:LinkButton

     

     

     

    >

    Please help me and give the code to set initialitemindex property server side.
    Its very urgent issue ,i have to release site within 1 day.
    Reply ASAP

    Thanks,
    Divya


     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  2. Niko
    Admin
    Niko avatar
    387 posts

    Posted 08 Jun 2011 Link to this post

    Hi,

    Unfortunately it is not possible to set the initialItemIndex through JavaScript on the client-side. Still you could change the current item at page load, however this functionality was introduced in later version of the controls. Your version cannot change the current item by its index. Therefore my advice would be to update your version of the controls so that you can take full advantage of the latest features and functionality.

    Hope this helps.

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

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. divya sahu
    divya sahu avatar
    16 posts
    Member since:
    Oct 2009

    Posted 08 Jun 2011 Link to this post

    Hi,

    Thanks a lot for quick reply.I have got one link to set IntialItemIndex property client side.
    Please check the link given below ,I tried the code given in the link,its not working for me.

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

    OR

    Please tell me how to change the current item at page load, as you suggested in your reply (explain with code example) .

    Thanks in advance

    Please do reply soon.

    Divya
  5. Niko
    Admin
    Niko avatar
    387 posts

    Posted 08 Jun 2011 Link to this post

    Hi,

    Please, note that the demo you have provided uses the latest version of the Telerik RadControls.
    You will need to attach to the OnClientLoad client event and call the rotator method set_currentItemIndex. Here is a sample function handler:
    function rotatorLoad(rotator, args)
    {
        rotator.set_currentItemIndex(3);
    }

    Hope this helps.

    Best wishes,
    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.

Back to Top