
DataBinding | 647
UI Namespace
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
DataBinder
System.Web.UI (system.web.dll)
sealed class
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 state-
ment <%# 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.
DataBinding
System.Web.UI (system.web.dll)
sealed class
This class represents a design-time data binding, which is contained in the DataBindingCol-
lection. Generally, most developers will create data bindings at runtime instead, which
allows increased flexibility and more transparent code.
You can configure data binding expressions by clicking the ellipsis (...) next to the
(DataBindings) option in the Visual ...