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

Detail Item Template row click event

1 Answer 17 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mir
Top achievements
Rank 1
Mir asked on 25 Jun 2015, 11:16 AM
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. 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 30 Jun 2015, 10:15 AM
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
Tags
Grid
Asked by
Mir
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or