This class contains a single shared utility method, Eval(
), which allows you to specify data binding for controls
like System.Web.UI.WebControls.DataList and
System.Web.UI.WebControls.Repeater. The
Eval( ) method accepts a string that identifies a
field in the control's data source and uses it to
retrieve the corresponding information. For example, the statement
<%# DataBinder.Eval(Container.DataItem,
"Name") %> in a template for a data control
would retrieve data from the Name field of the
control's bound data table. Note that you
don't need to use this method to create a data
binding expression (you can just use the <%#
Container.DataItem("Name") %> syntax, which is faster).
However, using the DataBinder method gives you the chance to supply a
format string to configure date or numeric values.
public sealed class DataBinder {
// Public Constructors
public DataBinder( );
// Public Static Methods
public static object Eval(object container, string expression);
public static string Eval(object container, string expression, string format);
public static object GetIndexedPropertyValue(object container, string expr);
public static string GetIndexedPropertyValue(object container, string propName, string format);
public static object GetPropertyValue(object container, string propName);
public static string GetPropertyValue(object container, string propName, string format);
}