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

Removing grouping column

1 Answer 118 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stein
Top achievements
Rank 1
Stein asked on 26 Jun 2013, 01:51 AM


We want to show a descriptive field as a heading column followed by a row of data - essentially grouping by one field value. The group works but want to remove the group by column. 

A few searches in the forum indicates changing the column width and font size of the grouping column would effectively hide it as in the following sample:
   protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
    {
        if (e.Column is GridGroupSplitterColumn)
        {
            //this doesn't do a thing
            e.Column.HeaderStyle.Width = System.Web.UI.WebControls.Unit.Pixel(0);
            e.Column.HeaderStyle.Font.Size = System.Web.UI.WebControls.FontUnit.Point(1);
            e.Column.ItemStyle.Width = System.Web.UI.WebControls.Unit.Pixel(0);
            e.Column.ItemStyle.Font.Size = System.Web.UI.WebControls.FontUnit.Point(1);
            e.Column.Resizable = false;
            
            //this works but messes up the text grouping row:
            //e.Column.Visible = false;
        }
    }

This doesn't work. Making the grouping column invisible DOES work but introduces a new problem. The grouping text appears in the second  column. It appears a <td></td> element appears for the first column, I assume this is was used for the grouping column. 

I have attached a picture to demonstrate the issue. The first image shows the grouping column using the above code. The second makes the column invisible, but now the grouping text is in the second column



1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 28 Jun 2013, 11:46 AM
Hello Stein,

I have prepared a sample RadGrid web site to demonstrate how you can achieve the requested functionality. Please run the attached application and let me know if it helps you.

Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Stein
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or