I am unable to get the self-referencing hierarchy to work. The table consists of many columns, but the two keys are svcref_id and svcref_parent_id - if it's a root node, those two would be the same, If it's a child, the svcref_parent_id would point to another svcref_id.
The way I have my grid set up is:
I have followed the example on your website, but this is how my grid looks at run-time (attached picture)
The only thing I changed (that I know of), besides changing RadGrid1 to the name of my grid, from your tutorial/demo is the following lines (my key).
and (also my key),
Thanks
The way I have my grid set up is:
<
telerik:RadGrid
runat
=
"server"
ID
=
"rgdSearch"
OnNeedDataSource
=
"rgdSearch_NeedDataSource"
Height
=
"180px"
Skin
=
"WebBlue"
Width
=
"775px"
OnItemCommand
=
"rgdSearch_ItemCommand"
OnColumnCreated
=
"RadGrid1_ColumnCreated"
OnItemCreated
=
"RadGrid1_ItemCreated"
OnItemDataBound
=
"RadGrid1_ItemDataBound"
>
<
MasterTableView
HierarchyDefaultExpanded
=
"true"
HierarchyLoadMode
=
"Client"
AutoGenerateColumns
=
"false"
AllowPaging
=
"true"
DataKeyNames
=
"svcref_id, svcref_parent_id"
PageSize
=
"5"
FilterExpression
=
"svcref_parent_id = svcref_id"
>
<
SelfHierarchySettings
ParentKeyName
=
"svcref_parent_id"
KeyName
=
"svcref_id"
/>
<
PagerStyle
AlwaysVisible
=
"true"
/>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"svcref_id"
UniqueName
=
"svcref_id"
Visible
=
"false"
/>
<
telerik:GridBoundColumn
DataField
=
"svcref_parent_id"
UniqueName
=
"svcref_parent_id"
Visible
=
"false"
/>
<
telerik:GridBoundColumn
HeaderText
=
"Service"
HeaderStyle-Height
=
"20px"
DataField
=
"svc_name"
UniqueName
=
"svc_name"
/>
</
Columns
>
<
NoRecordsTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblNoRecords"
Text
=
"There are no records to display."
meta:resourckey
=
"lblNoRecords"
></
asp:Label
>
</
NoRecordsTemplate
>
</
MasterTableView
>
<
ClientSettings
EnablePostBackOnRowClick
=
"true"
AllowExpandCollapse
=
"true"
>
<
Selecting
AllowRowSelect
=
"true"
EnableDragToSelectRows
=
"false"
/>
<
Scrolling
AllowScroll
=
"true"
UseStaticHeaders
=
"true"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
I have followed the example on your website, but this is how my grid looks at run-time (attached picture)
The only thing I changed (that I know of), besides changing RadGrid1 to the name of my grid, from your tutorial/demo is the following lines (my key).
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
CreateExpandCollapseButton(e.Item,
"svcref_id"
);
}
and (also my key),
protected
void
RadGrid1_ItemCreated(
object
sender, GridItemEventArgs e)
{
CreateExpandCollapseButton(e.Item,
"svcref_id"
);
Thanks