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

Access Data Bound To Rotator

1 Answer 71 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Brad
Top achievements
Rank 1
Brad asked on 04 Jun 2009, 03:04 PM
How can I access the DataRow thats bound to the specific Rotator Item when I am handling the ServerSide Click Event?

1 Answer, 1 is accepted

Sort by
0
Accepted
Fiko
Telerik team
answered on 05 Jun 2009, 06:44 AM
Hello Brad,

The arguments that is passed to the ItemClick event handler has property Item that is the item that is clicked. This way you can found the desired field inside the item template by using its FindControl function as follow :

protected void RadRotator1_ItemClick(object sender, Telerik.Web.UI.RadRotatorEventArgs e) 
    Label firstName = e.Item.FindControl("lblFirstName"as Label; 
    lblSelectedFName.Text = firstName.Text; 
 
    Label lastName = e.Item.FindControl("lblLastName"as Label; 
    lblSelectedLName.Text = lastName.Text; 

The RadRotator's declaration is :

<telerik:RadRotator ID="RadRotator1" runat="server" DataSourceID="AccessDataSource1" 
    Height="100px" Width="50px" ItemHeight="100px" ItemWidth="50px" OnItemClick="RadRotator1_ItemClick"
    <ItemTemplate> 
        <asp:Label ID="lblFirstName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Firstname") %>'></asp:Label> 
        <asp:Label ID="lblLastName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "LastName") %>'></asp:Label> 
    </ItemTemplate> 
</telerik:RadRotator> 

For your convenience I have attached the full demo to the thread(including the datasource).
I hope this helps.


Kind regards,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Rotator
Asked by
Brad
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Share this question
or