Answer:
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.
Asked In: Many Interviews |
Alert Moderator