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

Glossary Item Box

WebGrid.NET with Self Reference has a setting called ParentRootMode. ParentRootMode is a property as a pointer where the root of the self referencing table is.

ParentRootMode contains 3 options :

In order to use ParentRootMode based on the UseParentRootValue, we need to define some major SelfReference settings. Please check sample code belows:

C# Copy Code
WebGrid1.RootTable.SelfReferencingSettings.Enabled = true;
WebGrid1.RootTable.SelfReferencingSettings.ParentDataMember = "EmployeeID";
WebGrid1.RootTable.SelfReferencingSettings.ChildDataMember = "ReportsTo";
WebGrid1.RootTable.SelfReferencingSettings.ExpandColumnMember = "FirstName";
WebGrid1.RootTable.SelfReferencingSettings.ParentRootMode = ISNet.WebUI.WebGrid.ParentRootMode.UseParentRootValue;
// A DropDownList is configured with a collection of the possible values of ParentRootValue
WebGrid1.RootTable.SelfReferencingSettings.ParentRootValue = Int32.Parse(DropDownList1.SelectedItem.Value);

Above codes is recommended to be placed inside PrepareDataBinding event if Runtime Data Binding method is utilized, but if DesignTime Data Binding method is utilized, then it's safe to place above codes inside InitializeLayout or PrepareDataBinding event since the columns collection have been determined earlier using DesignTime Data Binding.

There are 4 major properties which need to be placed in order to configure Self Referencing table. They are : Enabled, ParentDataMember, ChildDataMember and ExpandColumnMember. Since we would like to designate a value other than 'Null' value as the ParentRootValue then the ParentRootMode property as well as ParentRootValue property need to be configured.

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.