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

GridGroupByExpression - change header text

2 Answers 165 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Darren
Top achievements
Rank 1
Darren asked on 20 Apr 2009, 09:27 PM

Hi, When adding grouping in the codebehind using the GridGroupByExpression is it possible to assign the header text of the grouping fields? Instead of 'SalesRegionDescription' I would like to display 'Sales Region'.

rgMain.MasterTableView.GroupByExpressions.Clear()

 

Dim expression1 As GridGroupByExpression = GridGroupByExpression.Parse("Geography, SalesRegionDescription Group By Geography, SalesRegionDescription")

 

rgMain.MasterTableView.GroupByExpressions.Add(expression1)

rgMain.MasterTableView.ShowGroupFooter =

True

Thanks

 

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 21 Apr 2009, 05:58 AM
Hi Darren,

Try out the following code snippet for Customizing GridGroupHeaderItem.

VB:
 
Protected Sub RadGrid1_ItemDataBound(ByVal sender As ObjectByVal e As GridItemEventArgs) 
    If TypeOf e.Item Is GridGroupHeaderItem Then 
        Dim item As GridGroupHeaderItem = DirectCast(e.Item, GridGroupHeaderItem) 
        Dim str As [String] = item.DataCell.Text 
        str = str.Replace("SalesRegionDescription""Sales Region"
        item.DataCell.Text = str 
    End If 
End Sub 

Thanks,
Shinu.
0
Princy
Top achievements
Rank 2
answered on 21 Apr 2009, 05:58 AM
Hello Darren,

You can set the FieldAlias property for the SelectFields to the required text as shown below:

VB:
Dim gridGroupByField As New GridGroupByField()  
gridGroupByField.FieldAlias = "SalesRegion"  
gridGroupByField.FieldName = "SalesRegionDescription" 
expression1.SelectFields.Add(gridGroupByField)  

Thanks
Princy.
Tags
Grid
Asked by
Darren
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Princy
Top achievements
Rank 2
Share this question
or