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

Grid grouping collapse not disabled

2 Answers 45 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rod
Top achievements
Rank 1
Rod asked on 28 Oct 2008, 04:19 PM
I have a simple grouped grid to which I have added the following code:

protected void personalRadGrid_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
    {
        if (e.Column is GridGroupSplitterColumn)
        {
            e.Column.Visible = false;
        }
    }

The grid also has a select column with check boxes.
But now, when I click on a group header in the check box column (no check boxes in the group rows), the row still collapses.

I've tried setting the AllowExpandCollapse and AllowGroupExpandCollapse in ClientSettings to false in the OnPreRender event of the page, but those don't seem to do anything.

How can I effectively prevent the user to collapse the grid while hiding the collapse/expand column?
This seems like a pretty common functionality that a lot of people struggle with.

Thanks,

Rod

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 29 Oct 2008, 04:23 AM
Hi Rod,

Try disabling the GroupSplitterColumn as shown below and see if it helps.

CS:
protected void RadGrid1_ColumnCreated(object  sender, Telerik.Web.UI.GridColumnCreatedEventArgs e) 
 if (e.Column is GridGroupSplitterColumn) 
 { 
   e.Column.HeaderStyle.Width = Unit.Pixel(1); 
   e.Column.HeaderStyle.Font.Size = FontUnit.Point(1); 
   e.Column.ItemStyle.Width = Unit.Pixel(1);   
   e.Column.ItemStyle.Font.Size = FontUnit.Point(1); 
 
   e.Column.Resizable = false
 } 

You can also go through the following help article.
Preventing groups expansion by hiding the expand/collapse images

Thanks
Shinu.
0
Rod
Top achievements
Rank 1
answered on 29 Oct 2008, 11:34 PM
Hi Shinu,

Thanks for your reply.

I implemented the code you recommended, but it's not working quite properly.

In Firefox, the grid now renders with the collapse column hidden, but the collapse image is still visible behind the text of the first column (and user can still click and collapse grid).
In IE, grid renders with collapse column just wide enough to see the edge of the plus/minus image and again, user can still click and collapse the grid.

I would attach an image/code sample if you could tell me how to do that in this forum.

Thanks,

Rod
Tags
Grid
Asked by
Rod
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Rod
Top achievements
Rank 1
Share this question
or