I've got a default GroupByExpression selecting a column, and it works great.
I already set the column titles programatically because they are translated in different languages. I was trying to figure out how do I set the HeaderText for the GridGroupField programatically? It doesn't automatically get the column title, I can't databind via ASP.NET (like <%# GetTitle() %>), and I don't see a created/databound item to alter in the same way I'm altering many items.
ASPX:
[code]
<GroupByExpressions>
<telerik:GridGroupByExpression>
<SelectFields>
<telerik:GridGroupByField FieldName="t_rv_account_group" HeaderText="CUSTOM VALUE HERE"/>
</SelectFields>
<GroupByFields>
<telerik:GridGroupByField FieldName="t_rv_account_group" />
</GroupByFields>
</telerik:GridGroupByExpression>
</GroupByExpressions>[/code]
It seems obvious now I've figured it out, but it took me enough time I thought I'd share. Since these are part of the HTML/ASP object, they of course are part of the object model, and can be modified in RadGrid1_PreRender() and can be set at the same time I'm setting translated column display titles.
C# CodeBehind:
[code]RadGrid1.MasterTableView.GroupByExpressions[0].SelectFields[0].HeaderText = CustomValueHereTitle;[/code]
This sets the specific one I knew about, or you can iterate the lists and map titles based on FieldName values.
I already set the column titles programatically because they are translated in different languages. I was trying to figure out how do I set the HeaderText for the GridGroupField programatically? It doesn't automatically get the column title, I can't databind via ASP.NET (like <%# GetTitle() %>), and I don't see a created/databound item to alter in the same way I'm altering many items.
ASPX:
[code]
<GroupByExpressions>
<telerik:GridGroupByExpression>
<SelectFields>
<telerik:GridGroupByField FieldName="t_rv_account_group" HeaderText="CUSTOM VALUE HERE"/>
</SelectFields>
<GroupByFields>
<telerik:GridGroupByField FieldName="t_rv_account_group" />
</GroupByFields>
</telerik:GridGroupByExpression>
</GroupByExpressions>[/code]
It seems obvious now I've figured it out, but it took me enough time I thought I'd share. Since these are part of the HTML/ASP object, they of course are part of the object model, and can be modified in RadGrid1_PreRender() and can be set at the same time I'm setting translated column display titles.
C# CodeBehind:
[code]RadGrid1.MasterTableView.GroupByExpressions[0].SelectFields[0].HeaderText = CustomValueHereTitle;[/code]
This sets the specific one I knew about, or you can iterate the lists and map titles based on FieldName values.