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

Hide / Disable Expand column

7 Answers 740 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Avi
Top achievements
Rank 1
Avi asked on 09 Apr 2010, 01:09 PM
Hello All,

I have a report which show data hierarchical data with three levels of grid.
I have used the nested view template for this.

Also, i have a selection on the top of the page, which allows the user to select the no of nested grids.
So, i need to hide the expand/collapse column based on the selection made.


Let me know, how should i approach to this.

Thanks,
Avi

7 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Apr 2010, 01:49 PM
Hello Avi,

Try the following code in order to hide the Expand/Collapse column in hierarchy.

C#:
 
    protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e) 
    { 
        if (e.Column.UniqueName == "ExpandColumn"
        { 
            e.Column.Visible = false
        }   
    } 

Regards,
Princy.
0
Ed McCarroll
Top achievements
Rank 1
answered on 15 Jun 2010, 07:40 PM
There are a number of similar posts, all trying to hide the expand/collapse column under one circumstance or another.

Has anybody come up with a solution for this yet?  I'm using Q1 2010 Asp.Net AJAX, .Net 3.5, with the Web20 skin, and I simply want the expand/contract column to disappear.
0
Princy
Top achievements
Rank 2
answered on 16 Jun 2010, 06:56 AM
Hello Ed McCarroll,

You can also try any of following approaches to hide the Expand/Collapse column.

1: Add the following CSS in your page.
CSS:
 <style type="text/css"
        .rgExpandCol 
        { 
            display:none !important; 
        } 
 </style>  

 2: Try the following code in PreRender event.
C#:
 
protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        RadGrid1.MasterTableView.ExpandCollapseColumn.Display = false
    } 

Thanks,
Princy.
0
Ed McCarroll
Top achievements
Rank 1
answered on 16 Jun 2010, 01:49 PM
Thanks, Princy, the CSS did the trick.

OTOH, using ExpandCollapseColumn.Display in the code-behind caused the same kind of header mismatch discussed in other posts.

But problem solved, and "You da man!"
0
Cameron Stitt
Top achievements
Rank 1
answered on 06 Jul 2010, 01:40 AM
I just worked out another way to do this without css for those that are interested.

    protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
      RadGrid1.MasterTableView.ExpandCollapseColumn.Display = false
      if(!Page.IsPostBack) 
      { 
        foreach (Telerik.Web.UI.GridDataItem item in RadGrid1.MasterTableView.Items) 
        { 
          item.Expanded = true
          item.ChildItem.Cells[0].Visible = false
        } 
      } 
    } 

0
Chanan Zass
Top achievements
Rank 1
answered on 12 Aug 2010, 03:12 PM
We have a 4-level hierarchical RadGrid and would like to show or hide the expand/collapse column in certain levels.

while the following works (expand/collapse column is  hidden on all levels)
RadGrid1.MasterTableView.ExpandCollapseColumn.Visible = False

this does not:
RadGrid1.MasterTableView.DetailTables(0).ExpandCollapseColumn.Visible = False

In other words, we can't seem to be able to control the expand/collapse column in DetailTables programmatically (the above code is included in the Page_Load method.

I should say that these other calls work with no problem:
RadGrid1.MasterTableView.DetailTables(0).Name = "Buyers"
RadGrid1.MasterTableView.DetailTables(0).CommandItemSettings.ShowAddNewRecordButton = False
RadGrid1.MasterTableView.DetailTables(0).DetailTables(0).Visible = False

Any idea why?
0
Oleg
Top achievements
Rank 1
answered on 28 Sep 2012, 02:13 PM
RadGrid1.MasterTableView.ExpandCollapseColumn.Visible = False

work fine, thanks!
Tags
Grid
Asked by
Avi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ed McCarroll
Top achievements
Rank 1
Cameron Stitt
Top achievements
Rank 1
Chanan Zass
Top achievements
Rank 1
Oleg
Top achievements
Rank 1
Share this question
or