Provides support for rapid application development (RAD) designers to generate and parse data-binding expression syntax. This class cannot be inherited.
Assembly: System.Web (in System.Web.dll)
Thetype exposes the following members.
|Equals(Object)||Determines whether the specified object is equal to the current object. (Inherited from Object.)|
|Eval(Object, String)||Evaluates data-binding expressions at run time.|
|Eval(Object, String, String)||Evaluates data-binding expressions at run time and formats the result as a string.|
|GetDataItem(Object)||Retrieves an object's declared data item.|
|GetDataItem(Object, Boolean%)||Retrieves an object's declared data item, indicating success or failure.|
|GetHashCode||Serves as the default hash function. (Inherited from Object.)|
|GetIndexedPropertyValue(Object, String)||Retrieves the value of a property of the specified container and navigation path.|
|GetIndexedPropertyValue(Object, String, String)||Retrieves the value of the specified property for the specified container, and then formats the results.|
|GetPropertyValue(Object, String)||Retrieves the value of the specified property of the specified object.|
|GetPropertyValue(Object, String, String)||Retrieves the value of the specified property of the specified object, and then formats the results.|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|IsBindableType||Determines whether the specified data type can be bound.|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
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.
Starting in .NET Framework 4.5, you can use model binding to simplify some of the tasks that you had to perform through data-binding in earlier versions. For a tutorial series on using model binding with Web Forms, see Model Binding and Web Forms.
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.
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.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.