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

Remove GridExpandColumn in Hierarchy grid

3 Answers 176 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sergey
Top achievements
Rank 1
Sergey asked on 06 Aug 2008, 01:33 PM

Hi

I have a grid with 2 tables hierarchy

System autogenerates <telerik:GridExpandColumn> columm. How I can remove it?
When I try to add ExpandCollapseColumn-Visible="false" for MasterTableView - no changes. Other properties works (for example ExpandCollapseColumn-ButtonType="ImageButton")

How I can remove this column?
(I wish to add expanding features to whole row)

When I try to add <telerik:GridExpandColumn></telerik:GridExpandColumn> System generates 2 expand columns

Current test grid is here:

<telerik:RadGrid ID="rgAttachmentsGrid" AllowPaging="False" runat="server"  Skin="CommonGrid" EnableEmbeddedSkins="false"  BorderStyle="Solid"  GridLines="None" AutoGenerateColumns="false" CellPadding="0" CellSpacing="0"    
OnItemCreated="rgAttachmentsGrid_ItemCreated" OnItemCommand="rgAttachmentsGrid_ItemCommand" > 
<MasterTableView DataKeyNames="AttGroupID" DataMember="Group" AutoGenerateColumns="False" EditMode="InPlace" InsertItemDisplay="Top" CommandItemDisplay="Top"  AllowAutomaticInserts="true"  BorderStyle="None" CellPadding="0" CellSpacing="0" 
      ExpandCollapseColumn-Visible="false"    > 
<CommandItemSettings AddNewRecordText="<%$ Language:Translate:str_Field_Editor_AddNewItem %>" RefreshText="<%$ Language:Translate:str_Field_Editor_Refresh %>" /> 
<DetailTables> 
<telerik:GridTableView DataKeyNames="AttachID" DataMember="Attachment" AutoGenerateColumns="false">  
     <ParentTableRelation> 
        <telerik:GridRelationFields DetailKeyField="AttGroupID" MasterKeyField="AttGroupID" /> 
    </ParentTableRelation> 
    <Columns> 
        <telerik:GridBoundColumn DataField="FileName" UniqueName="ID1" Visible="True" > 
        </telerik:GridBoundColumn> 
    </Columns>   
</telerik:GridTableView>   
</DetailTables> 
<Columns> 
 
 
<telerik:GridBoundColumn DataField="AttGroupID" UniqueName="ID" Visible="False" > 
</telerik:GridBoundColumn> 
<telerik:GridTemplateColumn> 
<ItemTemplate> 
<asp:LinkButton ID="lbGroup" runat="server" Width="100%"></asp:LinkButton> 
</ItemTemplate>   
</telerik:GridTemplateColumn> 
</Columns>   
</MasterTableView>   
</telerik:RadGrid> 



3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 07 Aug 2008, 05:52 AM
Hi Sergey,

Try the following code snippet to hide the Expand/Collapse column in RadGrid.

CS:
  protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        RadGrid1.MasterTableView.GetColumn("ExpandColumn").Display = false
    } 


Cheers
Shinu.
0
Sergey
Top achievements
Rank 1
answered on 07 Aug 2008, 06:17 AM
Hi Shinu, thanks for the answer!
This property helped me (as well as your solution)

ExpandCollapseColumn-Display

="false"

0
Matthew
Top achievements
Rank 1
answered on 30 Dec 2008, 09:05 PM
Thanks! This worked for me, too. Here is the VB version.

VB:
Protected Sub RadGrid1_PreRender(ByVal sender As ObjectByVal e As EventArgs) _  
    Handles RadGrid1.PreRender        
    RadGrid1.MasterTableView.GetColumn("ExpandColumn").Display = False       
End Sub     
 

Thanks, Matthew
Tags
Grid
Asked by
Sergey
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Sergey
Top achievements
Rank 1
Matthew
Top achievements
Rank 1
Share this question
or