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

Grouping Question

3 Answers 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
PJ Rodriguez
Top achievements
Rank 1
PJ Rodriguez asked on 09 Jul 2010, 06:38 PM
Is there a way to group the results in a RADGrid then hide the column that is being used to group the grid with?

For example, in the following demo: http://demos.telerik.com/aspnet-ajax/grid/examples/groupby/outlookstyle/defaultcs.aspx

The grouping is done using the Received column. What I want to be able to do is, keep the grouping but hide the Received column in the actual RADGrid and also hide the Header section of the RADGrid. Is this possible? Thanks!


PJ

3 Answers, 1 is accepted

Sort by
0
PJ Rodriguez
Top achievements
Rank 1
answered on 09 Jul 2010, 07:41 PM
Ok I was able to accomplish this by setting the grouping at design time and hiding the column that it's being grouped from on page load.

Another question, same demo:http://demos.telerik.com/aspnet-ajax/grid/examples/groupby/outlookstyle/defaultcs.aspx

The header on each grouping shows the format "Received from date: {Date Here}" (see sample header below):

Received from date: Monday, March 28, 2005

What I want is to remove the portion of the header Received from date: and just keep the portion of the header that says March 28, 2005. Is this possible? Thanks!


PJ

0
Accepted
Mira
Telerik team
answered on 14 Jul 2010, 12:03 PM
Hello PJ,

Please try using the following code to implement the desired functionality:
ASPX
<GroupByExpressions>
    <telerik:GridGroupByExpression>
        <SelectFields>
            <telerik:GridGroupByField FieldName="Received" FieldAlias="Date" FormatString="{0:D}">
            </telerik:GridGroupByField>
        </SelectFields>
        <GroupByFields>
            <telerik:GridGroupByField FieldName="Received" FieldAlias="Date" SortOrder="Descending">
            </telerik:GridGroupByField>
        </GroupByFields>
    </telerik:GridGroupByExpression>
</GroupByExpressions>
C#
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if (e.Item is GridGroupHeaderItem)
    {
        GridGroupHeaderItem item = (GridGroupHeaderItem)e.Item;
        DataRowView groupDataRow = (DataRowView)e.Item.DataItem;
        item.DataCell.Text = item.DataCell.Text.Split(':')[1];
    }
}

I hope this helps.

All the best,
Mira
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
0
PJ Rodriguez
Top achievements
Rank 1
answered on 16 Jul 2010, 12:34 AM
Thank you!! That worked!
Tags
Grid
Asked by
PJ Rodriguez
Top achievements
Rank 1
Answers by
PJ Rodriguez
Top achievements
Rank 1
Mira
Telerik team
Share this question
or