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

Expandable rows

3 Answers 176 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Carl
Top achievements
Rank 1
Carl asked on 21 Jan 2011, 09:36 PM
I'd like to make basic expandable rows in the RadGrid. Say your datasource provides 4 fields. The grid has columns defined for field1 & field2. Then if you expand the row, you see a dropdown area with information from field3 and field4. That was easy enough to do with a NestedViewTemplate and some <%# Eval() %> statements. But I need to do the same thing with client-side binding. Is this possible? I don't want a hierarchical table with another query to drop down, I just want to use fields already provided by that data row. This demo is a good example of the behavior I want, but it has server-side databinding, and it uses an extra query (which is ok if that's what it takes).
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplatedeclarativerelations/defaultcs.aspx
Thanks!

3 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 27 Jan 2011, 09:49 AM
Hi Carl,

You can Eval the additional fields in NastedViewTemplate. And set HierarchyLoadMode="Client" for the MasterTableView:

<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1">
  <MasterTableView AutoGenerateColumns="False" DataKeyNames="Field1" DataSourceID="SqlDataSource1" HierarchyLoadMode="Client">
    <Columns>
      <telerik:GridBoundColumn DataField="Field1"  HeaderText="Field1"UniqueName="Field1">
      </telerik:GridBoundColumn>
      <telerik:GridBoundColumn DataField="Field2"  HeaderText="Field2"UniqueName="Field2">
      </telerik:GridBoundColumn>
    </Columns>
    <NestedViewTemplate>
      Field3:
      <%# Eval("Field3")%>
      <br />
      Field4:
      <%# Eval("Field4")%>
    </NestedViewTemplate>
  </MasterTableView>
</telerik:RadGrid>

Regards,
Vasil
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Carl
Top achievements
Rank 1
answered on 27 Jan 2011, 10:30 PM
Thanks Vasil - perhaps I should clarify. I don't mean client-side hierarchy loading, I mean that the grid is consuming a webservice and populating itself on the client side. So it has 
    <ClientSettings>
        <DataBinding Location="MySvcs.asmx" SelectCountMethod="GetMyData"
            SelectMethod="GetMyData">
        </DataBinding>
    </ClientSettings>

In this case I can't use Eval because .NET is not involved when populating the rows. So I'd imagine I have to put some divs in the NestedViewTemplate and then populate them in some event - maybe OnRowDataBound? But I don't know how to access the NestedViewTemplate from there.
0
Vasil
Telerik team
answered on 01 Feb 2011, 02:42 PM
Hello Carl,

You can access to NestedView using get_nestedViews() client property of each grid data item. Client-side data binding for hierarchical structures is not supported out-of-the-box.

All the best,
Vasil
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Carl
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Carl
Top achievements
Rank 1
Share this question
or