The Bind keyword works like Eval to display data and can retrieve the value you've entered when updating or inserting a record. In addition, Bind is very useful in TemplateFields used in the GridView and DetailsView. Bind stores the value of the bound control property into a collection of values that the FormView control automatically retrieves and uses to compose the parameter list of the insert or edit command. The argument passed to Bind must match the name of a field in the data container.
The .NET Framwork 2.0 introduces Eval(). Eval() is a shortcut for Container.DataItem() (or DataBinder.Eval() in .Net Framework 1.1). Since Eval() uses Reflection, it causes overhead. From a optimization standpoint, it is better to use Container.DataItem().Note: If you use Eval in the edit item template, the Eval-ed value will not be able to be passed to the Update method of the datasource.
No comments:
Post a Comment