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

Grouping question

2 Answers 29 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 03 Nov 2010, 11:11 PM
For this code:

http://demos.telerik.com/aspnet-ajax/grid/examples/groupby/outlookstyle/defaultcs.aspx

Is it possible to remove the field name : from the group header text (so the grouping only shows the value, i.e. "Saturday,March 28, 2010").

Thanks,

Richard

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 04 Nov 2010, 07:24 AM
Hello Richard,

The following code snippet shows how to achieve this. Access the GridGroupHeaderItem and get the group header text using HeaderItem.DataCell.Text. Then customize the text like below.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
   {
       if (e.Item is GridGroupHeaderItem)
       {
           GridGroupHeaderItem headerItem = (GridGroupHeaderItem)e.Item;
           string grptext = headerItem.DataCell.Text;
           string[] gropfield = grptext.Split(':');
           headerItem.DataCell.Text = gropfield[1].ToString();
       }
   }

Thanks,
Princy.
0
Richard
Top achievements
Rank 1
answered on 04 Nov 2010, 04:13 PM
That worked.  Thank you.
Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Richard
Top achievements
Rank 1
Share this question
or