Eval() method provides only for displaying data from a datasource in a contral
Bind() method provides for two-way binding which means that it cannot be used to display as well update date from a datasource.
Both Eval and Bind apply to the templated controls like the GridView, FormsView.
But there are certain differences
1)Eval method:
a)It supports only one way binding. It means that we can only read data from the
column using Eval method.
b)It does not need the ID of a particular control
example:
<table>
<tr>
<td><%#Eval("productname")%> </td>
</tr>
</table>
is OK.
c)It applies to controls like the GridView, DataList, Repeater, ListView, FormsView, DetailsView.
1)Bind method:
a)It supports two way binding. It means that we can read data and modify data using the Bind method.
b)It always needs the ID of a particular control
example:
<table>
<tr>
<td><%#Bind("productname")%> </td>
</tr>
</table>
is WRONG
we have to take some UI control like Label aand specify the Binding in the
Text property.
c)It applies to controls like the GridView, FormsView, DetailsView.
Reference to the web site http://www.cnblogs.com/DareOnly/archive/2008/08/28/1278168.html
浙公网安备 33010602011771号