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

Group heading in radgrid

4 Answers 123 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Nagendra
Top achievements
Rank 1
Nagendra asked on 05 Jul 2011, 07:30 AM
Hi All,

 In my project i have one radtreeview and radgrid. when i check particular child node i am binding radgrid. These functionalities working fine. But i want to display radtreeview parent node and child node as a heading on radgrid.
I want to display heading like which is in Groupheadings.png screen shot in radgrid_with_radtreeview.png screen shot.

Please anybody help me.


Thanks,
Nagendra.

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 Jul 2011, 07:54 AM
Hello Nagendra,

You can try the following approach to customize the Group header text.

C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
     if ( e.Item is GridGroupHeaderItem )
     {
      GridGroupHeaderItem item = (GridGroupHeaderItem)e.Item;
      DataRowView groupDataRow = (DataRowView)e.Item.DataItem;
      item.DataCell.Text = "";
       foreach( DataColumn column in groupDataRow.DataView.Table.Columns)
          if ( column.ColumnName == "Country" )
            {
             //Here you can set the Tree node text.
             item.DataCell.Text += "Customized display - Country is " + groupDataRow["Country"].ToString();
            }
      }
     }

Thanks,
Shinu.
0
Nagendra
Top achievements
Rank 1
answered on 05 Jul 2011, 01:46 PM
Hi Shinu,

Here my problem is i have checkboxes in the radtreeview.
i want to set the group heading as radtreeview checked node text (root and child node text).


Thanks,
Nagendra.
 
0
Shinu
Top achievements
Rank 2
answered on 06 Jul 2011, 10:47 AM
Hello Nagendra,

As far I understand you are populating the grid in node click event. So one approach is to save that node and Its parent text in a global variable and show it as the group header text.

Thanks,
Shinu.
0
Nagendra
Top achievements
Rank 1
answered on 19 Jul 2011, 07:28 AM
Hi Shinu,

     In my scenario group heading working fine when i select only child node(Lot1). But when i select parent node (Angel Falls or Phase1) it's displaying wrong group heading in the radgrid.
 Please find the below screen shot of my page.
my code is
----------------------------
Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs)
If TypeOf e.Item Is GridGroupHeaderItem Then
            Dim item As GridGroupHeaderItem = DirectCast(e.Item, GridGroupHeaderItem)
            Dim groupDataRow As DataRowView = DirectCast(e.Item.DataItem, DataRowView)
             item.DataCell.Text = ""
            For Each column As DataColumn In groupDataRow.DataView.Table.Columns
                If column.ColumnName = "lot_id" Then
                       item.DataCell.Text = RadTreeView1.CheckedNodes(item.GroupIndex).FullPath
               Else
                    
                End If
               Next
           End If

Thanks,
Nagendra.
Tags
ComboBox
Asked by
Nagendra
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Nagendra
Top achievements
Rank 1
Share this question
or