Sunday, 3 April 2016

What is difference of Eval and Bind functions in ASP.Net?

Eval function is Read-Only binding.
It takes the name of data field and return  a string for the value for that field.
…………….
<tr>
<td>Full Name </td>
<td><%# Eval(“FullName”) %></td>
</tr>

Bind function is Updateable binding. Therefore, data can be modified.  This method is used with input controls such as TextBox.

…………………
<tr>
<td>Full Name </td>
<td>
<asp:TextBox id=”txtname” runat=”Server” Text = ‘<%# Bind(“FullName”) %>’>
</td>
</tr>

Both functions are used within delimiters <%# and %>