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

Hirearchical Grid Format

10 Answers 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
parimal
Top achievements
Rank 1
parimal asked on 18 Nov 2008, 01:05 AM
Hi,

I have a requirement to develop a HTML Grid/Table that display data in the following format:

                                                                                                Col 1    Col 2    Col 3    Col 4
-----------------------------------------------------------------------------------------------------------------
- Row 1                                                                                    100          25        25        50
   - Row 11                                                                                 30          10        10        10  
        - Row 12                                                                            40          15        20        5
            - Row 13                                                                        90          30        30        30
+ Row 2
+ Row 3

Can this format be possible in the RAD Grid using Hierarchical option. If there is any sample code or reference, please let me know.
Column values calculation is not needed. I am looking for the col and row format.

regards,

Parimal

    

10 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Nov 2008, 07:34 AM
Hello Parimal,

A possible suggestion is to use a normal hierarchial grid and hide the headers for the DetailTables by setting the ShowHeader attribute for the DetailTable to false.
aspx:
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" > 
   <MasterTableView DataSourceID="SqlDataSource1" Name="Master" > 
       <DetailTables> 
           <telerik:GridTableView ShowHeader="false" Name="Detail1" DataSourceID="SqlDataSource2" runat="server"
             .... 

Thanks
Princy.
0
Sridevi
Top achievements
Rank 1
answered on 18 Nov 2008, 01:26 PM
Hi,
Is there any possibility of binding dataset or datatable to DetailTables(GridTableView) in RadGrid without using sqldatasource.
Thanks
Sridevi.
0
Sebastian
Telerik team
answered on 18 Nov 2008, 04:24 PM
Hi Sridevi,

You can intercept the DetailTableDataBind event of RadGrid to assign data source for each detail table in its hierarchy dynamically without using data source controls. Review the following online demo of the product for more details:

http://demos.telerik.com/ASPNET/Prometheus/Grid/Examples/Programming/DetailTableDataBind/DefaultCS.aspx

@parimal:
You may consider taking advantage of the self-referencing hierarchy feature of the grid as well to attain the presentation you are after:

http://demos.telerik.com/ASPNET/Prometheus/Grid/Examples/Hierarchy/SelfReferencing/DefaultCS.aspx

Kind regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
parimal
Top achievements
Rank 1
answered on 24 Nov 2008, 09:29 AM
Hi,

Thanks for the response.

How can we make the hierarchical grid mentioned in the below example as "Expanded" at all nodes?
http://demos.telerik.com/ASPNET/Prometheus/Grid/Examples/Programming/DetailTableDataBind/DefaultCS.aspx

regards,

Parimal
0
Vlad
Telerik team
answered on 24 Nov 2008, 09:34 AM
Hello parimal,

You can set HierarchyDefaultExpanded to true for desired GridTableView.

Kind regards,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
parimal
Top achievements
Rank 1
answered on 24 Nov 2008, 10:16 AM
Hi,

Thanks for the response.

I am able to expand the desired detailtableview with the below settings.

How can i expand fom the top most node to bottom most node on button click?

regards,

Parimal
0
Shinu
Top achievements
Rank 2
answered on 24 Nov 2008, 10:28 AM
Hi Parimal,

You can set HierarchyDefaultExpanded property to true in the buttton click event.

CS:
 protected void Button1_Click(object sender, EventArgs e) 
    { 
        RadGrid1.MasterTableView.HierarchyDefaultExpanded = true
        RadGrid1.MasterTableView.Rebind(); 
    } 


Shinu.

0
Sebastian
Telerik team
answered on 24 Nov 2008, 11:29 AM
Hi guys,

You can also traverse the nested tables for a particular item from the master table and expand its detail table records if needed. How to iterate through grid items in hierarchy you can see from this help topic.

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
parimal
Top achievements
Rank 1
answered on 25 Nov 2008, 02:14 AM
Hi,

Thanks for the response.
I am looking for one more help/solution.

The Hierarchical grid in the below example is having server side code on expansion and collapse.
http://demos.telerik.com/ASPNET/Prometheus/Grid/Examples/Programming/DetailTableDataBind/DefaultCS.aspx

Can the same example be done using client side events so that we dont have any servside hit or postback.

regards,

Parimal
0
Shinu
Top achievements
Rank 2
answered on 25 Nov 2008, 05:26 AM
Hi Parimal,

You can achieve the same functionality by setting the following property
GridTableView.HierarchyLoadMode  to HierarchyLoadMode.Client.  
This  is similar to HierarchyLoadMode.ServerBind but the items are expanded/collapsed from client-side, using JavaScript manipulations instead of postback to the server.
Go through the online demo for getting more information 

Client-side hierarchy loading

Thanks,
Shinu.
Tags
Grid
Asked by
parimal
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Sridevi
Top achievements
Rank 1
Sebastian
Telerik team
parimal
Top achievements
Rank 1
Vlad
Telerik team
Shinu
Top achievements
Rank 2
Share this question
or