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

Equivalent to RowDetailsTemplate?

4 Answers 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Roberto
Top achievements
Rank 1
Roberto asked on 29 Oct 2012, 05:34 PM
Hi,

I've used the RowDetailsTemplate tag in the Silverlight version of the Grid and can't seem to be able to reproduce this same functionality in .Net AJAX. How could I achieve this? I basically need a panel with some text to show up when someone clicks on an item.

Thanks,


4 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 01 Nov 2012, 11:23 AM
Hi Roberto,

The RadGrid control's had an DetailItemTemplate since Q3 2012 release. Please check out the following example which demonstrates it:
http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/detailitemtemplate/defaultcs.aspx

I hope this helps.

Kind regards,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Roberto
Top achievements
Rank 1
answered on 01 Nov 2012, 06:24 PM
Hi Radoslav, 

Unfortunately that is not the behavior I'm looking for. I've already implemented the DetailItemTemplate but it shows all the time. What I want is just like in Silverlight where it only shows when you click on a row. Is this possible?
0
Accepted
Brad
Top achievements
Rank 1
answered on 02 Nov 2012, 03:25 PM
Not sure if this is the best way, but here is how I did it.

Defined the DetailItemTemplate with a class on the label for jquery selection
<DetailItemTemplate>
    <asp:Label ID="LabelDetails" Class="LabelDetails" runat="server" Text='<%# Eval("Notes") %>' />
</DetailItemTemplate>

In the grids client events I added OnRowSelected and OnGridCreated events.
<ClientSettings EnableRowHoverStyle="true">
    <Selecting AllowRowSelect="True" />
    <ClientEvents OnRowSelected="ShowNotes" OnGridCreated="ShowNotes" />
</ClientSettings>

And added a Script ShowNotes to handle the show and hide.
<script>
    function ShowNotes(sender, eventArgs) {
        $(".LabelDetails").parent().parent().hide();
        var MasterTable = sender.get_masterTableView();
        var selectedRows = MasterTable.get_selectedItems();
        if (selectedRows.length > 0) {
            $($(selectedRows[0])[0]._element).next("tr").show();
        }
    }
</script>
0
Roberto
Top achievements
Rank 1
answered on 03 Nov 2012, 06:04 PM
Thanks Brad, I think that would work, would be great if this was the default behavior.
Tags
Grid
Asked by
Roberto
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Roberto
Top achievements
Rank 1
Brad
Top achievements
Rank 1
Share this question
or