Group heading in radgrid

5 posts, 0 answers
  1. Nagendra
    Nagendra avatar
    35 posts
    Member since:
    Jan 2011

    Posted 05 Jul 2011 Link to this post

    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.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 05 Jul 2011 Link to this post

    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.
  3. Nagendra
    Nagendra avatar
    35 posts
    Member since:
    Jan 2011

    Posted 05 Jul 2011 Link to this post

    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.
     
  4. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 06 Jul 2011 Link to this post

    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.
  5. Nagendra
    Nagendra avatar
    35 posts
    Member since:
    Jan 2011

    Posted 19 Jul 2011 Link to this post

    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.
Back to Top