Detail Item Template row click event

2 posts, 0 answers
  1. Mir
    Mir avatar
    5 posts
    Member since:
    Aug 2014

    Posted 25 Jun 2015 Link to this post

    I am using Detail Item Template for displaying some extra information on radgrid. I want to highlight the Detail Item Template row as well as its parent row while clicking on the Detail Item Template row. Is there any way to handle Detail Item Template row's click event? Any help will be highly appreciated.
    Thanks in advance. 
  2. Eyup
    Admin
    Eyup avatar
    3754 posts

    Posted 30 Jun 2015 Link to this post

    Hi Mir,

    You can wrap the entire content in a Container element to implement the following logic:
    <DetailItemTemplate>
        <asp:Panel ID="Panel1" runat="server" onclick='<%# "detailItemClick("+(Container.RowIndex/3-1)+");"%>'
    JavaScript:
    function detailItemClick(index) {
        var dataItems = $find('<%= RadGrid1.ClientID %>').get_masterTableView().get_dataItems();
        var row = dataItems[index].get_element();
        row.style.backgroundColor = "lime";
        $(row).next()[0].style.backgroundColor = "lime";
    }

    Hope this helps. I am also attaching a sample RadGrid web site to demonstrate Hover effect over the DetailItemTemplate.

    Regards,
    Eyup
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top