GroupByExpression
="StartTimeGB Arrived Group By StartTimeGB"
There are examples of how to declare one using markup, but all of them cause the grid to come up grouped by default, which I don't want. How can I do this without the default grouping?
Thanks,
Levi
5 Answers, 1 is accepted
Can you elaborate more on your scenario? Do you mean that you need to modify the GroupHeader text? If yes. please review this help topic.
In addition you can have a look at the following links for further information on RadGrid group-by expressions:
http://www.telerik.com/help/aspnet-ajax/grdgroupbydeclarativedefinition.html
http://www.telerik.com/help/aspnet-ajax/grdgroupbyprogrammaticdefinition.html
Let me know if I can help you further.
Kind regards,
Iana
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Both those examples cause the grid to come up grouped by default, which I don't want. I want the user to initiate the grouping by dragging and dropping the column... and then the string is properly formatted. I did find a temporary solution however, although it is kind of whacky. I have to remove the field and then re-add it so I can apply the dataformatstring. Is there a better way? I don't see why you can't define a group by field without it coming up grouped by default when the grid loads...
protected void RadGridSummary_GroupsChanging(object source, Telerik.Web.UI.GridGroupsChangingEventArgs e)
{
if (e.Action == GridGroupsChangingAction.Group)
{
if (e.Expression.GroupByFields[0].FieldName == "StartTimeGB")
{
GridGroupByField gbfNew = new GridGroupByField();
gbfNew.FieldName = "StartTimeGB";
gbfNew.FieldAlias = "Arrived";
gbfNew.FormatString = "{0:D}";
e.Expression.SelectFields.Clear();
e.Expression.SelectFields.Add(gbfNew);
e.Expression.GroupByFields.Clear();
e.Expression.GroupByFields.Add(gbfNew);
}
}
}
Indeed if you set your group-by expression on Page_Load or declaratively, it is expected that the grid will be initially grouped. This is because the purpose of setting group-by expression to RadGrid is to group it.
However if you would like to change the formatting of the group header, you can do using you implementation or customize the GridGroupHeaderItem as shown in the following topic:
http://www.telerik.com/help/aspnet-ajax/grdcustomizegridgroupheaderitem.html
I hope this helps.
Best wishes,
Iana
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

"Value of type 'Telerik.Web.UI.GridItem' cannot be converted to 'Telerik.WebControls.GridGroupHeaderItem"
at compilation time when trying to
Dim item As Telerik.WebControls.GridGroupHeaderItem = CType(e.Item, Telerik.WebControls.GridGroupHeaderItem)
Try modifying your code as below and let me know if it makes any difference:
Dim
item
As
Telerik.Web.UI.GridGroupHeaderItem =
CType
(e.Item, Telerik.Web.UI.GridGroupHeaderItem)
All the best,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.