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

[Solved] Self-referencing Hierarchy

1 Answer 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryan C
Top achievements
Rank 1
Ryan C asked on 19 Oct 2009, 01:42 PM
Reffering to this demo:
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/selfreferencing/defaultcs.aspx

Can anyone please indicate how I can hide the id columns?

 

 

<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" OnColumnCreated="RadGrid1_ColumnCreated"

 

 

 

OnItemCreated="RadGrid1_ItemCreated" OnItemDataBound="RadGrid1_ItemDataBound"

 

 

 

Skin="Sunset" >

 

 

 

 

 

<MasterTableView HierarchyDefaultExpanded="false" HierarchyLoadMode="Client" AllowSorting="true"

 

 

 

DataKeyNames="id, parentid" Width="100%" FilterExpression="id=1">

 

 

 

 

 

<SelfHierarchySettings ParentKeyName="parentid" KeyName="id" />

 

 

 

 

 

<Columns>

 

 

 

 

 

<telerik:GridTemplateColumn UniqueName="TemplateEditColumn">

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

<asp:HyperLink ID="EditLink" runat="server" Text="Edit"></asp:HyperLink>

 

 

 

 

 

</ItemTemplate>

 

 

 

 

 

</telerik:GridTemplateColumn>

 

 

 

 

 

</Columns>

 

 

 

 

 

</MasterTableView>

 

 

 

 

 

<ClientSettings AllowExpandCollapse="true">

 

 

 

</ClientSettings>

 

 

 

 

 

</telerik:RadGrid>

 

1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 22 Oct 2009, 11:03 AM
Hello Ryan C,

You can intercept the ColumnCreated server event of the grid (raised for auto-generated columns), determine the id column by its UniqueName value and set its Display or Visible property to false. See the information from this documentation article for further details.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Ryan C
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or