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

Set Rotator intialItenIndex property using javascript

3 Answers 45 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
divya sahu
Top achievements
Rank 1
divya sahu asked on 08 Jun 2011, 08:36 AM
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


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3 Answers, 1 is accepted

Sort by
0
Niko
Telerik team
answered on 08 Jun 2011, 12:45 PM
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.

0
divya sahu
Top achievements
Rank 1
answered on 08 Jun 2011, 01:44 PM
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
0
Niko
Telerik team
answered on 08 Jun 2011, 02:59 PM
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.

Tags
Rotator
Asked by
divya sahu
Top achievements
Rank 1
Answers by
Niko
Telerik team
divya sahu
Top achievements
Rank 1
Share this question
or