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

Default Group Express doesn't ungroup

5 Answers 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Christopher
Top achievements
Rank 1
Christopher asked on 05 Jan 2011, 08:20 PM
I'm using a RadGrid with a relatively straightforward setup of DataBound columns, and a single Grid Expression that I set on page load like this: 

if (!Page.IsPostBack)
{
    //set up an initial group by base
    var baseExpression = new GridGroupByExpression();
    var selectField = new GridGroupByField {FieldAlias = "Base", FieldName = "Dest_Name", HeaderValueSeparator = " "};
    baseExpression.SelectFields.Add(selectField);
 
    var groupField = new GridGroupByField() {FieldName = "Dest_Name"};
    baseExpression.GroupByFields.Add(groupField);
 
    Grid.MasterTableView.GroupByExpressions.Add(baseExpression);
}

I then load the data via DataSource = foo and DataBind();

The problem comes when I right click on the column header and select ungroup form the menu, it doesn't get ungrouped.  I can group and ungroup with other columns, but the initial column does not ungroup, unless I use the menu to group by the column, and then ungroup it.

Is there a way around this behaviour?

5 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 10 Jan 2011, 12:20 PM
Hello Christopher,

Note that grouping is not supported with simple data-binding (calling DataBind()) as explained in the description section of the following online example:
http://demos.telerik.com/aspnet-ajax/grid/examples/groupby/outlookstyle/defaultcs.aspx

Greetings,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Christopher
Top achievements
Rank 1
answered on 10 Jan 2011, 03:17 PM
So does that mean that I can only use declarative databinding if i want to have grouping?
0
Pavlina
Telerik team
answered on 11 Jan 2011, 10:56 AM
Hi Christopher,

When you want the grid to perform grouping functionality you can also use Advanced DataBinding(using NeedDataSource event) rather than Simple DataBinding. Try to populate grid using Advanced DataBinding and see whether this avoids the issue. 

The following online example shows how to populate grid using Advanced DataBinding:
Grid / Advanced Data Binding 

All the best,

Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Christopher
Top achievements
Rank 1
answered on 11 Jan 2011, 03:20 PM
I get the same behavior when using the NeedDataSource event.

I wire up the event during Page_Init:
Grid.NeedDataSource += GetGridData;

With the code for the event looking like this:
private void GetGridData(object sender, GridNeedDataSourceEventArgs e)
{
        ((RadGrid) sender).DataSource =               AnalysisManager.GetAircraftSupportability(CurrentlySelectedPlan);
}

0
Pavlina
Telerik team
answered on 13 Jan 2011, 03:52 PM
Hi Christopher,

Can you please verify that EnableViewState property of the RadGrid is set to true? Keep in mind that RadGrid does not manage grouping states when its ViewState is disabled. Please refer to the following help article for more information:

Optimizing ViewState usage

If you need to use grouping in RadGrid, its ViewState should be enabled.

Kind regards,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Christopher
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Christopher
Top achievements
Rank 1
Share this question
or