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

Do not display the Field Alias in Group Header

2 Answers 201 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chenghan
Top achievements
Rank 1
Chenghan asked on 20 Jul 2009, 05:31 AM
Hello,

There is an issue that users don't want to see the field alias in group header.
I tried to set it as "FieldAlias = ' '",  but it raised an error.
The error message is "Field definition is not valid. FieldAlias contains invalid characters"
Is it possible to reslove my issue? Thanks ahead.

Best regards
Chenghan

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 20 Jul 2009, 06:51 AM
Hello Chenghan,

The FieldAlias value cannot contain blanks or reserved characters such as ",", "." and so on. This property is useful only when you want to change the value displayed in group header (different than the default DataField column value) or group by a template column and Telerik RadGrid cannot get the header text for that column. So for your scenario, you can consider customizing the groupheader text as shown below:

c#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.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.
0
Justyn
Top achievements
Rank 1
answered on 23 Sep 2010, 08:41 PM
Nice solution!
Tags
Grid
Asked by
Chenghan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Justyn
Top achievements
Rank 1
Share this question
or