This documentation is archived and is not being maintained.

DataBinder Class

Provides support for rapid application development (RAD) designers to generate and parse data-binding expression syntax. This class cannot be inherited.

System::Object
  System.Web.UI::DataBinder

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

public ref class DataBinder sealed

The DataBinder type exposes the following members.

  NameDescription
Public methodDataBinderInfrastructure. Initializes a new instance of the DataBinder class.
Top

  NameDescription
Public propertyStatic memberEnableCachingGets or sets a value that indicates whether data caching is enabled at run time.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public methodStatic memberEval(Object, String)Evaluates data-binding expressions at run time.
Public methodStatic memberEval(Object, String, String)Evaluates data-binding expressions at run time and formats the result as a string.
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodStatic memberGetDataItem(Object)Retrieves an object's declared data item.
Public methodStatic memberGetDataItem(Object, Boolean%)Retrieves an object's declared data item, indicating success or failure.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodStatic memberGetIndexedPropertyValue(Object, String)Retrieves the value of a property of the specified container and navigation path.
Public methodStatic memberGetIndexedPropertyValue(Object, String, String)Retrieves the value of the specified property for the specified container, and then formats the results.
Public methodStatic memberGetPropertyValue(Object, String)Retrieves the value of the specified property of the specified object.
Public methodStatic memberGetPropertyValue(Object, String, String)Retrieves the value of the specified property of the specified object, and then formats the results.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

You can use the overloaded static Eval method of this class in data-binding syntax in an ASP.NET Web page. This provides an easier syntax to work with than standard data binding. However, because DataBinder.Eval provides automatic type conversion, it can result in slower performance.

For more information about ASP.NET data binding, expressions, and syntax, see Binding to Databases and Data-Binding Expressions Overview.

The following example uses the static GetPropertyValue method to populate the fields of a Repeater control using an ArrayList of Product objects. The Eval method could be applied with the same syntax, but it would not perform as quickly.

This example uses a custom Product class which exposes a string Model property and a numeric UnitPrice property.

No code example is currently available or this language may not be supported.

The following code is the custom Product class. This code should be included in a separate class file in the App_Code directory, such as Product.cs or Product.vb.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: