Access Data Bound To Rotator

2 posts, 1 answers
  1. Brad
    Brad avatar
    8 posts
    Member since:
    Jun 2009

    Posted 04 Jun 2009 Link to this post

    How can I access the DataRow thats bound to the specific Rotator Item when I am handling the ServerSide Click Event?
  2. Answer
    Fiko avatar
    1406 posts

    Posted 05 Jun 2009 Link to this post

    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"
            <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> 

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

    Kind regards,
    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.
Back to Top