PerformDataBinding Method

HierarchicalDataBoundControl.PerformDataBinding Method ()


When overridden in a derived class, binds data from the data source to the control.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

protected internal virtual void PerformDataBinding()

Implement this method instead of the DataBind method when you derive a data-bound control from the HierarchicalDataBoundControl class. Placing your control's data-binding logic in PerformDataBinding keeps the DataBinding and DataBound events from being raised in the wrong order.

While the base HierarchicalDataBoundControl class provides no specific implementation for this method, the PerformDataBinding method is called by the PerformSelect method to bind the values of any user interface controls to the data that is retrieved by the PerformSelect method.

The following code example demonstrates how to implement the PerformDataBinding method in a class derived from HierarchicalDataBoundControl. The GeneologyTree control iterates through the IHierarchicalEnumerable and IHierarchyData objects retrieved from its associated 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 HierarchicalDataBoundControl class.

Snippet section 4 of code snippet {"project_id":"3fedad16-eaf1-41a6-8f96-0c1949c68f32","entity_id":"a472936e-54fb-4d85-9076-3441247e433e","entity_type":"CodeSnippet","locale":"en-US"} in source file ({"filename":"/CS/geneologytree.cs","blob_type":"Source","blob_id":"-002fcs-002fgeneologytree-002ecs","blob_revision":3}) overlaps with other snippet sections. Ensure the tags are placed correctly.

.NET Framework
Available since 2.0
Return to top
© 2015 Microsoft