Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
475 lines (427 sloc) 33 KB
<Type Name="HierarchicalDataBoundControl" FullName="System.Web.UI.WebControls.HierarchicalDataBoundControl">
<TypeSignature Language="C#" Value="public abstract class HierarchicalDataBoundControl : System.Web.UI.WebControls.BaseDataBoundControl" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract beforefieldinit HierarchicalDataBoundControl extends System.Web.UI.WebControls.BaseDataBoundControl" />
<TypeSignature Language="DocId" Value="T:System.Web.UI.WebControls.HierarchicalDataBoundControl" />
<TypeSignature Language="VB.NET" Value="Public MustInherit Class HierarchicalDataBoundControl&#xA;Inherits BaseDataBoundControl" />
<TypeSignature Language="C++ CLI" Value="public ref class HierarchicalDataBoundControl abstract : System::Web::UI::WebControls::BaseDataBoundControl" />
<TypeSignature Language="F#" Value="type HierarchicalDataBoundControl = class&#xA; inherit BaseDataBoundControl" />
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Web.UI.WebControls.BaseDataBoundControl</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.ComponentModel.Designer("System.Web.UI.Design.WebControls.HierarchicalDataBoundControlDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5">
<AttributeName>System.ComponentModel.Designer("System.Web.UI.Design.WebControls.HierarchicalDataBoundControlDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Serves as the base class for all ASP.NET version 2.0 data-bound controls that display their data in hierarchical form.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl> class is the base class used for ASP.NET controls that retrieve data from an ASP.NET hierarchical data source control and bind user-interface elements of the control to that data for display. The <xref:System.Web.UI.WebControls.TreeView> and <xref:System.Web.UI.WebControls.Menu> classes derive from <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl>.
Page developers do not use the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl> class directly; instead, they use controls that derive from this class.
Controls developers extend this class to create data-bound controls that work with classes that implement the <xref:System.Web.UI.IHierarchicalDataSource> interface and classes that derive from the <xref:System.Web.UI.HierarchicalDataSourceControl> and <xref:System.Web.UI.HierarchicalDataSourceView> classes. When deriving a class from the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl> class, override the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformDataBinding%2A> method to bind the user-interface elements of your control to data retrieved by the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.GetData%2A> method. In most cases, the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformDataBinding%2A> method is the only method you will override in your derived class.
For ASP.NET 2.0 data-bound controls, the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect%2A> method is the equivalent of the <xref:System.Web.UI.WebControls.BaseDataBoundControl.DataBind%2A> method, and is called to bind data at run time. The <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect%2A> method calls the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.GetData%2A> and <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformDataBinding%2A> methods.
## Examples
The following code example demonstrates how to derive a class from the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl> class to create a custom data-bound control. The `GeneologyTree` control renders a `pre` HTML section with a text tree for the data retrieved from an associated data source control.
[!code-csharp[Samples.AspNet.GeneologyTree#2](~/samples/snippets/csharp/VS_Snippets_WebNet/Samples.AspNet.GeneologyTree/CS/geneologytree.cs#2)]
[!code-vb[Samples.AspNet.GeneologyTree#2](~/samples/snippets/visualbasic/VS_Snippets_WebNet/Samples.AspNet.GeneologyTree/VB/geneologytree.vb#2)]
The following code example demonstrates how to use the `GeneologyTree` control, defined in the previous example, and bind it to an <xref:System.Web.UI.WebControls.XmlDataSource> control.
[!code-aspx-csharp[Samples.AspNet.GeneologyTree#1](~/samples/snippets/csharp/VS_Snippets_WebNet/Samples.AspNet.GeneologyTree/CS/rootviewcs.aspx#1)]
[!code-aspx-vb[Samples.AspNet.GeneologyTree#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/Samples.AspNet.GeneologyTree/VB/rootviewvb.aspx#1)]
The geneology.xml file accessed in the code example contains the following data.
```
<family>
<member title="great-grandfather">
<member title="grandfather" >
<member title="child" />
<member title="father" >
<member title="son" />
</member>
</member>
</member>
</family>
```
]]></format>
</remarks>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected HierarchicalDataBoundControl ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.HierarchicalDataBoundControl.#ctor" />
<MemberSignature Language="VB.NET" Value="Protected Sub New ()" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; HierarchicalDataBoundControl();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Web.UI.WebControls.HierarchicalDataBoundControl" /> class.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="DataSourceID">
<MemberSignature Language="C#" Value="public override string DataSourceID { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string DataSourceID" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.HierarchicalDataBoundControl.DataSourceID" />
<MemberSignature Language="VB.NET" Value="Public Overrides Property DataSourceID As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::String ^ DataSourceID { System::String ^ get(); void set(System::String ^ value); };" />
<MemberSignature Language="F#" Value="member this.DataSourceID : string with get, set" Usage="System.Web.UI.WebControls.HierarchicalDataBoundControl.DataSourceID" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.Web.UI.IDReferenceProperty(typeof(System.Web.UI.HierarchicalDataSourceControl))</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the ID of the control from which the data-bound control retrieves its list of data items.</summary>
<value>The ID of a control that represents the data source from which the data-bound control retrieves its data. The default is <see cref="F:System.String.Empty" />.</value>
<remarks>To be added.</remarks>
<altmember cref="P:System.Web.UI.WebControls.BaseDataBoundControl.DataSourceID" />
</Docs>
</Member>
<Member MemberName="GetData">
<MemberSignature Language="C#" Value="protected virtual System.Web.UI.HierarchicalDataSourceView GetData (string viewPath);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance class System.Web.UI.HierarchicalDataSourceView GetData(string viewPath) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.HierarchicalDataBoundControl.GetData(System.String)" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Function GetData (viewPath As String) As HierarchicalDataSourceView" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual System::Web::UI::HierarchicalDataSourceView ^ GetData(System::String ^ viewPath);" />
<MemberSignature Language="F#" Value="abstract member GetData : string -&gt; System.Web.UI.HierarchicalDataSourceView&#xA;override this.GetData : string -&gt; System.Web.UI.HierarchicalDataSourceView" Usage="hierarchicalDataBoundControl.GetData viewPath" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Web.UI.HierarchicalDataSourceView</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="viewPath" Type="System.String" />
</Parameters>
<Docs>
<param name="viewPath">The hierarchical path of the view to retrieve.</param>
<summary>Retrieves a <see cref="T:System.Web.UI.HierarchicalDataSourceView" /> object that the data-bound control uses to perform data operations.</summary>
<returns>The <see cref="T:System.Web.UI.HierarchicalDataSourceView" /> object that the data-bound control uses to perform data operations.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.GetData%2A> method retrieves a <xref:System.Web.UI.HierarchicalDataSourceView> object from the associated data source control by calling the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.GetDataSource%2A> method.
## Examples
The following code example demonstrates how the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.GetData%2A> method is called to retrieve the <xref:System.Web.UI.HierarchicalDataSourceView> object from the associated data source control and how the <xref:System.Web.UI.HierarchicalDataSourceView.Select%2A?displayProperty=nameWithType> method is called to retrieve the data. This code example is part of a larger example provided for the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl> class.
[!code-csharp[Samples.AspNet.GeneologyTree#4](~/samples/snippets/csharp/VS_Snippets_WebNet/Samples.AspNet.GeneologyTree/CS/geneologytree.cs#4)]
[!code-vb[Samples.AspNet.GeneologyTree#4](~/samples/snippets/visualbasic/VS_Snippets_WebNet/Samples.AspNet.GeneologyTree/VB/geneologytree.vb#4)]
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">A <see cref="T:System.Web.UI.HierarchicalDataSourceView" /> could not be retrieved for the specified <paramref name="viewPath" />.</exception>
<altmember cref="P:System.Web.UI.WebControls.DataBoundControl.DataMember" />
<altmember cref="M:System.Web.UI.WebControls.HierarchicalDataBoundControl.GetDataSource" />
</Docs>
</Member>
<Member MemberName="GetDataSource">
<MemberSignature Language="C#" Value="protected virtual System.Web.UI.IHierarchicalDataSource GetDataSource ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance class System.Web.UI.IHierarchicalDataSource GetDataSource() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.HierarchicalDataBoundControl.GetDataSource" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Function GetDataSource () As IHierarchicalDataSource" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual System::Web::UI::IHierarchicalDataSource ^ GetDataSource();" />
<MemberSignature Language="F#" Value="abstract member GetDataSource : unit -&gt; System.Web.UI.IHierarchicalDataSource&#xA;override this.GetDataSource : unit -&gt; System.Web.UI.IHierarchicalDataSource" Usage="hierarchicalDataBoundControl.GetDataSource " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Web.UI.IHierarchicalDataSource</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Retrieves the <see cref="T:System.Web.UI.IHierarchicalDataSource" /> that the data-bound control is associated with, if any.</summary>
<returns>An <see cref="T:System.Web.UI.IHierarchicalDataSource" /> instance that represents the data source identified by the <see cref="P:System.Web.UI.WebControls.DataBoundControl.DataSourceID" /> property.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.GetData%2A> method calls the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.GetDataSource%2A> method internally.
]]></format>
</remarks>
<exception cref="T:System.Web.HttpException">The data source control identified by the <see cref="P:System.Web.UI.WebControls.HierarchicalDataBoundControl.DataSourceID" /> property does not exist in the current container.
-or-
The data source control identified by the <see cref="P:System.Web.UI.WebControls.HierarchicalDataBoundControl.DataSourceID" /> property does not implement the <see cref="T:System.Web.UI.IHierarchicalDataSource" /> interface.</exception>
<altmember cref="M:System.Web.UI.WebControls.HierarchicalDataBoundControl.GetData(System.String)" />
<altmember cref="T:System.Web.UI.IHierarchicalDataSource" />
</Docs>
</Member>
<Member MemberName="MarkAsDataBound">
<MemberSignature Language="C#" Value="protected void MarkAsDataBound ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig instance void MarkAsDataBound() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.HierarchicalDataBoundControl.MarkAsDataBound" />
<MemberSignature Language="VB.NET" Value="Protected Sub MarkAsDataBound ()" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; void MarkAsDataBound();" />
<MemberSignature Language="F#" Value="member this.MarkAsDataBound : unit -&gt; unit" Usage="hierarchicalDataBoundControl.MarkAsDataBound " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Sets the state of the control in view state as successfully bound to data.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The data-bound control maintains a value in view state that indicates whether it is currently bound to data. The <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.MarkAsDataBound%2A> method sets the value to `true`.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="OnDataPropertyChanged">
<MemberSignature Language="C#" Value="protected override void OnDataPropertyChanged ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void OnDataPropertyChanged() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.HierarchicalDataBoundControl.OnDataPropertyChanged" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Sub OnDataPropertyChanged ()" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override void OnDataPropertyChanged();" />
<MemberSignature Language="F#" Value="override this.OnDataPropertyChanged : unit -&gt; unit" Usage="hierarchicalDataBoundControl.OnDataPropertyChanged " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Called when one of the base data source identification properties is changed, to re-bind the data-bound control to its data.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.OnDataPropertyChanged%2A> method is called when the <xref:System.Web.UI.WebControls.BaseDataBoundControl.DataSource%2A> or <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.DataSourceID%2A> is changed any time after the page's <xref:System.Web.UI.Control.PreRender> event.
## Examples
The following code example demonstrates how a data-bound control can call the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.OnDataPropertyChanged%2A> method if a property that identifies a data source is changed after the data-bound control is initialized. This code example is part of a larger example provided for the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl> class.
[!code-csharp[Samples.AspNet.GeneologyTree#3](~/samples/snippets/csharp/VS_Snippets_WebNet/Samples.AspNet.GeneologyTree/CS/geneologytree.cs#3)]
[!code-vb[Samples.AspNet.GeneologyTree#3](~/samples/snippets/visualbasic/VS_Snippets_WebNet/Samples.AspNet.GeneologyTree/VB/geneologytree.vb#3)]
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="OnDataSourceChanged">
<MemberSignature Language="C#" Value="protected virtual void OnDataSourceChanged (object sender, EventArgs e);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnDataSourceChanged(object sender, class System.EventArgs e) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.HierarchicalDataBoundControl.OnDataSourceChanged(System.Object,System.EventArgs)" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub OnDataSourceChanged (sender As Object, e As EventArgs)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual void OnDataSourceChanged(System::Object ^ sender, EventArgs ^ e);" />
<MemberSignature Language="F#" Value="abstract member OnDataSourceChanged : obj * EventArgs -&gt; unit&#xA;override this.OnDataSourceChanged : obj * EventArgs -&gt; unit" Usage="hierarchicalDataBoundControl.OnDataSourceChanged (sender, e)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="sender" Type="System.Object" />
<Parameter Name="e" Type="System.EventArgs" />
</Parameters>
<Docs>
<param name="sender">The source of the event, the <see cref="T:System.Web.UI.IHierarchicalDataSource" /> object.</param>
<param name="e">An <see cref="T:System.EventArgs" /> object that contains event data.</param>
<summary>Called when the <see cref="T:System.Web.UI.IHierarchicalDataSource" /> instance that the data-bound control works with raises the <see cref="E:System.Web.UI.IDataSource.DataSourceChanged" /> event.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl> class handles the <xref:System.Web.UI.IHierarchicalDataSource.DataSourceChanged> event to set the <xref:System.Web.UI.WebControls.BaseDataBoundControl.RequiresDataBinding%2A> property to `true`.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="OnLoad">
<MemberSignature Language="C#" Value="protected internal override void OnLoad (EventArgs e);" />
<MemberSignature Language="ILAsm" Value=".method familyorassemblyhidebysig virtual instance void OnLoad(class System.EventArgs e) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.HierarchicalDataBoundControl.OnLoad(System.EventArgs)" />
<MemberSignature Language="VB.NET" Value="Protected Friend Overrides Sub OnLoad (e As EventArgs)" />
<MemberSignature Language="C++ CLI" Value="protected public:&#xA; override void OnLoad(EventArgs ^ e);" />
<MemberSignature Language="F#" Value="override this.OnLoad : EventArgs -&gt; unit" Usage="hierarchicalDataBoundControl.OnLoad e" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="e" Type="System.EventArgs" />
</Parameters>
<Docs>
<param name="e">An <see cref="T:System.EventArgs" /> object that contains event data.</param>
<summary>Handles the <see cref="E:System.Web.UI.Control.Load" /> event.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl> handles the Load event to set the <xref:System.Web.UI.WebControls.BaseDataBoundControl.RequiresDataBinding%2A> property to `true` if the HTTP request is not a postback.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="OnPagePreLoad">
<MemberSignature Language="C#" Value="protected override void OnPagePreLoad (object sender, EventArgs e);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void OnPagePreLoad(object sender, class System.EventArgs e) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.HierarchicalDataBoundControl.OnPagePreLoad(System.Object,System.EventArgs)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Sub OnPagePreLoad (sender As Object, e As EventArgs)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override void OnPagePreLoad(System::Object ^ sender, EventArgs ^ e);" />
<MemberSignature Language="F#" Value="override this.OnPagePreLoad : obj * EventArgs -&gt; unit" Usage="hierarchicalDataBoundControl.OnPagePreLoad (sender, e)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="sender" Type="System.Object" />
<Parameter Name="e" Type="System.EventArgs" />
</Parameters>
<Docs>
<param name="sender">The <see cref="T:System.Web.UI.Page" /> that raised the event.</param>
<param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param>
<summary>Sets the initialized state of the data-bound control before the control is loaded.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.OnPagePreLoad%2A> sets the <xref:System.Web.UI.WebControls.BaseDataBoundControl.RequiresDataBinding%2A> property to `true` in cases where the HTTP request is a postback and view state is enabled but the data-bound control has not yet been bound. This scenario is common with controls such as <xref:System.Web.UI.WebControls.Wizard> and <xref:System.Web.UI.WebControls.MultiView> where the visibility of the control is changed at run time.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="PerformDataBinding">
<MemberSignature Language="C#" Value="protected internal virtual void PerformDataBinding ();" />
<MemberSignature Language="ILAsm" Value=".method familyorassemblyhidebysig newslot virtual instance void PerformDataBinding() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformDataBinding" />
<MemberSignature Language="VB.NET" Value="Protected Friend Overridable Sub PerformDataBinding ()" />
<MemberSignature Language="C++ CLI" Value="protected public:&#xA; virtual void PerformDataBinding();" />
<MemberSignature Language="F#" Value="abstract member PerformDataBinding : unit -&gt; unit&#xA;override this.PerformDataBinding : unit -&gt; unit" Usage="hierarchicalDataBoundControl.PerformDataBinding " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>When overridden in a derived class, binds data from the data source to the control.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Implement this method instead of the <xref:System.Web.UI.WebControls.BaseDataBoundControl.DataBind%2A> method when you derive a data-bound control from the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl> class. Placing your control's data-binding logic in <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformDataBinding%2A> keeps the <xref:System.Web.UI.Control.DataBinding> and <xref:System.Web.UI.WebControls.BaseDataBoundControl.DataBound> events from being raised in the wrong order.
While the base <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl> class provides no specific implementation for this method, the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformDataBinding%2A> method is called by the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect%2A> method to bind the values of any user interface controls to the data that is retrieved by the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect%2A> method.
## Examples
The following code example demonstrates how to implement the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformDataBinding%2A> method in a class derived from <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl>. The `GeneologyTree` control iterates through the <xref:System.Web.UI.IHierarchicalEnumerable> and <xref:System.Web.UI.IHierarchyData> objects retrieved from its associated <xref:System.Web.UI.HierarchicalDataSourceView>, and creates a text tree structure for the data it is bound to. This code example is part of a larger example provided for the <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl> class.
[!code-csharp[Samples.AspNet.GeneologyTree#4](~/samples/snippets/csharp/VS_Snippets_WebNet/Samples.AspNet.GeneologyTree/CS/geneologytree.cs#4)]
[!code-vb[Samples.AspNet.GeneologyTree#4](~/samples/snippets/visualbasic/VS_Snippets_WebNet/Samples.AspNet.GeneologyTree/VB/geneologytree.vb#4)]
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="PerformSelect">
<MemberSignature Language="C#" Value="protected override void PerformSelect ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void PerformSelect() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Sub PerformSelect ()" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override void PerformSelect();" />
<MemberSignature Language="F#" Value="override this.PerformSelect : unit -&gt; unit" Usage="hierarchicalDataBoundControl.PerformSelect " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Retrieves data from the associated data source.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect%2A> method is called, after data is retrieved, to bind data to elements of the data-bound control. Derived types override this method to retrieve data only if the default implementation is not adequate.
]]></format>
</remarks>
<altmember cref="M:System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformDataBinding" />
</Docs>
</Member>
<Member MemberName="ValidateDataSource">
<MemberSignature Language="C#" Value="protected override void ValidateDataSource (object dataSource);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void ValidateDataSource(object dataSource) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.HierarchicalDataBoundControl.ValidateDataSource(System.Object)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Sub ValidateDataSource (dataSource As Object)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override void ValidateDataSource(System::Object ^ dataSource);" />
<MemberSignature Language="F#" Value="override this.ValidateDataSource : obj -&gt; unit" Usage="hierarchicalDataBoundControl.ValidateDataSource dataSource" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dataSource" Type="System.Object" />
</Parameters>
<Docs>
<param name="dataSource">An object set to the <see cref="P:System.Web.UI.WebControls.BaseDataBoundControl.DataSource" /> property.</param>
<summary>Verifies that the object a data-bound control binds to is one it can work with.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl.ValidateDataSource%2A> method is called only in the <xref:System.Web.UI.WebControls.BaseDataBoundControl> class's mutator (setter) for the <xref:System.Web.UI.WebControls.BaseDataBoundControl.DataSource%2A> property. The <xref:System.Web.UI.WebControls.HierarchicalDataBoundControl> class checks the type of the object that is set for the <xref:System.Web.UI.WebControls.BaseDataBoundControl.DataSource%2A> property to ensure that it is an instance of the <xref:System.Web.UI.IHierarchicalEnumerable> or <xref:System.Web.UI.IHierarchicalDataSource> interfaces.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">
<paramref name="dataSource" /> is not <see langword="null" /> and implements neither the <see cref="T:System.Web.UI.IHierarchicalEnumerable" /> nor the <see cref="T:System.Web.UI.IHierarchicalDataSource" /> interface.</exception>
<altmember cref="P:System.Web.UI.WebControls.BaseDataBoundControl.DataSource" />
<altmember cref="M:System.Web.UI.WebControls.BaseDataBoundControl.ValidateDataSource(System.Object)" />
</Docs>
</Member>
</Members>
</Type>
You can’t perform that action at this time.