Intersoft WebGrid Documentation
Creating Self Reference Table
See Also Send comments on this topic.
Intersoft WebGrid > Learning More > Working with Self Referencing Table > Creating Self Reference Table

Glossary Item Box

SelfReference makes a simple flat grid becomes hierarchical. It is because of the reference from one column to another based on the DataMember in it. There are numerous UI settings applicable to this feature, such as TreeView selection mode, parent root mode, AutoFit column on expand, and more.

You bind data the same way as you usually do in a normal flat table. The grid will then be able to automatically group the child rows based on SelfReferenceSettings. This feature works perfectly in conjunction with all existing features such as sorting, grouping and so on.

DEs

Based on the picture above, WebGrid.NET designer provides a collection of settings called SelfReferenceSettings. These settings will reflect to WebGrid's SelfReference feature.

The picture belows will show how the SelfReference works.

Result

FirstName is an ExpandColumnMember, EmployeeID is a ParentDataMember, and ReportsTo is a ChildDataMember. Please don't forget to enable the Enabled property at the SelfReferenceSettings.

Please take a look carefully at the FirstName, EmployeeID, and ReportsTo columns. EmployeeID has 2 as a DataMember, and it will be a parent for some of ReportsTo column DataMember that has 2 as the values, and so on. FirstName column will be added a + icon to expand the self reference hierarchy and - icon to collapse.

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.