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

Removing Expand/Collapse Column in Hierarchical Grids

7 Answers 608 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kencox
Top achievements
Rank 1
kencox asked on 14 Oct 2009, 03:26 PM
Hi,

I'm using the hierarchical grid scenario to display records and child records using templates. Everything is expanded and will never be collapsed.

How do I remove the expand/collapse column that is automatically generated by Radgrid?

Thanks,

Ken

7 Answers, 1 is accepted

Sort by
0
Thomas Salt
Top achievements
Rank 1
answered on 14 Oct 2009, 03:58 PM
RadGrid1.MasterTableView.ExpandCollapseColumn.Visible = false;
0
kencox
Top achievements
Rank 1
answered on 14 Oct 2009, 04:09 PM
Thanks for the reply Thomas, but that doesn't do it.

Do have a project that demonstrates the removal of all expand/collapse columns from all grids in the hierarchy?

Ken
0
Thomas Salt
Top achievements
Rank 1
answered on 14 Oct 2009, 05:09 PM
I'm not sure about the example, but if you set ExpandCollapseColumn-Display="false" in your HTML for all of your GridTableView declarations it should hide it...it hides it correctly in my projects...
0
kencox
Top achievements
Rank 1
answered on 14 Oct 2009, 08:51 PM
Maybe it 'should' hide the column, but it doesn't for me.

I added your suggested markup to the Grid's Declarative Relations demo (http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/declarativerelations/defaultcs.aspx) without success. The markup I used appears below.

Does anyone else know how to remove the Expand/Collapse column in a hierarachical grid?

Ken


    <telerik:RadGrid OnPreRender="RadGrid1_PreRender" ID="RadGrid1" ShowStatusBar="true" 
        DataSourceID="SqlDataSource1" ExpandCollapseColumn-Display="false" ExpandCollapseColumn-Visible="false" 
        runat="server" AutoGenerateColumns="False" PageSize="7" AllowSorting="True" AllowMultiRowSelection="False" 
        AllowPaging="True" GridLines="None">  
        <PagerStyle Mode="NumericPages"></PagerStyle> 
        <MasterTableView DataSourceID="SqlDataSource1" DataKeyNames="CustomerID" AllowMultiColumnSorting="True">  
            <DetailTables> 
                <telerik:GridTableView DataKeyNames="OrderID" DataSourceID="SqlDataSource2" Width="100%" 
                    runat="server">  
                    <ParentTableRelation> 
                        <telerik:GridRelationFields DetailKeyField="CustomerID" MasterKeyField="CustomerID" /> 
                    </ParentTableRelation> 
                    <DetailTables> 
                        <telerik:GridTableView DataKeyNames="OrderID" DataSourceID="SqlDataSource3" Width="100%" 
                            ExpandCollapseColumn-Display="false" ExpandCollapseColumn-Visible="false" runat="server">  
                            <ParentTableRelation> 
                                <telerik:GridRelationFields DetailKeyField="OrderID" MasterKeyField="OrderID" /> 
                            </ParentTableRelation> 
                            <Columns> 
                                <telerik:GridBoundColumn SortExpression="UnitPrice" HeaderText="Unit Price" HeaderButtonType="TextButton" 
                                    DataField="UnitPrice" UniqueName="UnitPrice">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn SortExpression="Quantity" HeaderText="Quantity" HeaderButtonType="TextButton" 
                                    DataField="Quantity" UniqueName="Quantity">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn SortExpression="Discount" HeaderText="Discount" HeaderButtonType="TextButton" 
                                    DataField="Discount" UniqueName="Discount">  
                                </telerik:GridBoundColumn> 
                            </Columns> 
                            <SortExpressions> 
                                <telerik:GridSortExpression FieldName="Quantity" SortOrder="Descending"></telerik:GridSortExpression> 
                            </SortExpressions> 
                        </telerik:GridTableView> 
                    </DetailTables> 
                    <Columns> 
                        <telerik:GridBoundColumn SortExpression="OrderID" HeaderText="OrderID" HeaderButtonType="TextButton" 
                            DataField="OrderID" UniqueName="OrderID">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn SortExpression="OrderDate" HeaderText="Date Ordered" HeaderButtonType="TextButton" 
                            DataField="OrderDate" UniqueName="OrderDate" DataFormatString="{0:D}">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn SortExpression="Freight" HeaderText="Freight" HeaderButtonType="TextButton" 
                            DataField="Freight" UniqueName="Freight">  
                        </telerik:GridBoundColumn> 
                    </Columns> 
                    <SortExpressions> 
                        <telerik:GridSortExpression FieldName="OrderDate"></telerik:GridSortExpression> 
                    </SortExpressions> 
                </telerik:GridTableView> 
            </DetailTables> 
            <Columns> 
                <telerik:GridBoundColumn SortExpression="CustomerID" HeaderText="CustomerID" HeaderButtonType="TextButton" 
                    DataField="CustomerID" UniqueName="CustomerID">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn SortExpression="ContactName" HeaderText="Contact Name" HeaderButtonType="TextButton" 
                    DataField="ContactName" UniqueName="ContactName">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn SortExpression="CompanyName" HeaderText="Company" HeaderButtonType="TextButton" 
                    DataField="CompanyName" UniqueName="CompanyName">  
                </telerik:GridBoundColumn> 
            </Columns> 
            <SortExpressions> 
                <telerik:GridSortExpression FieldName="CompanyName"></telerik:GridSortExpression> 
            </SortExpressions> 
        </MasterTableView> 
    </telerik:RadGrid> 
0
Thomas Salt
Top achievements
Rank 1
answered on 15 Oct 2009, 01:38 PM
Try putting it in the "<MasterTableView " and " <GridTableView " declarations instead of the <RadGrid> declaration.

IE: <MasterTableView ExpandCollapseColumn-Display=false

Do you do any table creation in your code behind?
0
Nicolaï
Top achievements
Rank 2
answered on 27 May 2010, 10:06 AM
Well, I'm getting tired of fighting this column that is created when you don't want it... Especially for exports. and sometimes you just want to make your own code for it, using a template column.

Why does  ExpandCollapseColumn-Visible="false" not work?
Why are the properties that have no effect whatsoever even there? Just to tease me!? lol
0
Sebastian
Telerik team
answered on 27 May 2010, 11:52 AM
Hello Nicolai,

You can remove the expand/collapse column on export (when having grid hierarchy) by setting the ExportSettings -> HideStructureColumns boolean property of the grid as explained here.

To hide the expand/collapse columns in grouped or hierarchical grid explicitly on the page, utilize the options presented in the forum threads below:

http://www.telerik.com/community/forums/aspnet-ajax/grid/hide-the-left-column-in-grid-hierarchy.aspx
http://www.telerik.com/community/forums/aspnet-ajax/grid/hide-disable-expand-column.aspx

http://www.telerik.com/community/forums/aspnet-ajax/grid/can-t-hide-expand-and-collapse-images-in-radgrid.aspx 

Best regards,
Sebastian
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
kencox
Top achievements
Rank 1
Answers by
Thomas Salt
Top achievements
Rank 1
kencox
Top achievements
Rank 1
Nicolaï
Top achievements
Rank 2
Sebastian
Telerik team
Share this question
or