Intersoft WebGrid Documentation
ParentRootMode Property
See Also  Example Send Feedback
ISNet.WebUI.WebGrid Namespace > SelfReferencingSettings Class : ParentRootMode Property






Determines how parent rows are populated.

Syntax

Visual Basic (Declaration) 
<NotifyParentPropertyAttribute(True)>
<DefaultValueAttribute()>
<ISNet.Serialization.XmlSerializableAttribute()>
<DescriptionAttribute("Specifies the behavior that used by WebGrid to determine root/parent.")>
<ISNet.Serialization.BinarySerializableAttribute()>
Public Property ParentRootMode As ParentRootMode
Visual Basic (Usage)Copy Code
Dim instance As SelfReferencingSettings
Dim value As ParentRootMode
 
instance.ParentRootMode = value
 
value = instance.ParentRootMode
C# 
[NotifyParentPropertyAttribute(true)]
[DefaultValueAttribute()]
[ISNet.Serialization.XmlSerializableAttribute()]
[DescriptionAttribute("Specifies the behavior that used by WebGrid to determine root/parent.")]
[ISNet.Serialization.BinarySerializableAttribute()]
public ParentRootMode ParentRootMode {get; set;}
Delphi 
public read-write property ParentRootMode: ParentRootMode; 
JScript 
NotifyParentPropertyAttribute()
DefaultValueAttribute()
ISNet.Serialization.XmlSerializableAttribute()
DescriptionAttribute("Specifies the behavior that used by WebGrid to determine root/parent.")
ISNet.Serialization.BinarySerializableAttribute()
public function get,set ParentRootMode : ParentRootMode
Managed Extensions for C++ 
[NotifyParentPropertyAttribute(true)]
[DefaultValueAttribute()]
[ISNet.Serialization.XmlSerializableAttribute()]
[DescriptionAttribute("Specifies the behavior that used by WebGrid to determine root/parent.")]
[ISNet.Serialization.BinarySerializableAttribute()]
public: __property ParentRootMode get_ParentRootMode();
public: __property void set_ParentRootMode( 
   ParentRootMode value
);
C++/CLI 
[NotifyParentPropertyAttribute(true)]
[DefaultValueAttribute()]
[ISNet.Serialization.XmlSerializableAttribute()]
[DescriptionAttribute("Specifies the behavior that used by WebGrid to determine root/parent.")]
[ISNet.Serialization.BinarySerializableAttribute()]
public:
property ParentRootMode ParentRootMode {
   ParentRootMode get();
   void set (    ParentRootMode value);
}

Example

The following 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.
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(DropDownList1SelectedItem.Value);

Remarks

WebGrid.NET with Self Reference has a setting called ParentRootMode, which is a property where the root of the self referencing table point to. There are three options of ParentRootMode to determine where the self referencing table point to: UseParetRootValue, NullValue, SelfReferencingNode.

  • UseParentRootValue : UseParentrootValue is a property to show self reference table based on the parent value.
  • NullValue : NullValue is a property to show self reference table based on null value.
  • SelfReferencingNode : SelfReferencingNode is a property to show the self reference table based on only the parentnode which has reference.

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

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.