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

[Solved] Remove the ExpandCollapseColumn

1 Answer 112 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 02 Sep 2009, 09:17 AM
Hi. I think I've tried everything, and I can't get rid of it. I want detail tables, but not the expandcollapsecolumn. This is what I have so far:

In the declaration:
<MasterTableView> 
    ... 
    <ExpandCollapseColumn Visible="false" Display="false" /> 
    ... 
</MasterTableView> 

In code:
protected void Roles_PreRender( object sender, EventArgs e ) 
    (RoleGrid.MasterTableView.GetColumn( "ExpandColumn" ) as GridExpandColumn).Visible = false
    RoleGrid.MasterTableView.Columns[0].Visible = false
 
protected void RoleGrid_ItemCreated( object sender, GridItemEventArgs e ) 
    if( e.Item is GridDataItem ) 
    { 
        (e.Item as GridDataItem)["ExpandColumn"].Visible = false
    } 
}  

With all this, I still end up with the ExpandColumn header showing up. The actual column cells are hidden, which causes all my other cells to be shifted left, thus getting their data in a row one left of their header... does it really have to be this hard to get rid of that thing?





1 Answer, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 04 Sep 2009, 03:45 PM
Have you tried the following code-behind?

protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)  
    {  
        if (e.Column.UniqueName == "ExpandColumn")  
        {  
            e.Column.Display = false;  
        }  
    }  

If I recall correctly the unique name of the ExpandCollapseColumn is ExpandColumn. Let me know how it goes!


Tags
Grid
Asked by
Alexander
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Share this question
or