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

[Solved] grouping field title

2 Answers 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael Tao
Top achievements
Rank 1
Michael Tao asked on 21 Dec 2009, 08:12 AM
Hi :
 
                    <telerik:GridGroupByExpression> 
                        <SelectFields> 
                            <telerik:GridGroupByField FieldAlias="StartDate" FieldName="Start" FormatString="{0:d}"></telerik:GridGroupByField> 
                        </SelectFields> 
                        <GroupByFields> 
                            <telerik:GridGroupByField FieldName="Start" SortOrder="Ascending" FormatString="{0:d}"></telerik:GridGroupByField> 
                        </GroupByFields> 
                    </telerik:GridGroupByExpression> 
In the source-code above, a field named Start is added into the GridField and the grouping field title will be something like
StartDate:2009-10-1. However, it is possible to remove the StartDate and just show 2009-10-1.
Does anyone have idea for it?

2 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 21 Dec 2009, 08:33 AM
Hi Michael Tao,

Please refer to the following help aritcle:

http://www.telerik.com/help/aspnet-ajax/grdcustomizegridgroupheaderitem.html

Regards,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Princy
Top achievements
Rank 2
answered on 21 Dec 2009, 09:44 AM
Hello Michael,

Try out the following code to customize the group header so as to display just the value:
c#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridGroupHeaderItem) 
        { 
            GridGroupHeaderItem item = (GridGroupHeaderItem)e.Item; 
            string[] myArr = item.DataCell.Text.Split(':'); 
            item.DataCell.Text = myArr[1].Trim(); 
        }  
    } 

Thanks
Princy.
Tags
Grid
Asked by
Michael Tao
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Princy
Top achievements
Rank 2
Share this question
or