posted 3/10/2009 by Vijendra Shakya
Bind(): Bind method used when user can modify the value i.e for edit/update. Bind is a 2 way of databinding i.e. bi-directional databinding.Eval(): Eval is one way Binding i.e. it is like read only.Suppose we have a gridview control and want to only display the data, not perform any other action then we can use Eval() to bind the data.If we want to edit the information in the gridview then we use Bind().
<asp:TemplateField HeaderText="Name"> <EditItemTemplate> <asp:TextBox ID="txtName" Text='<%# Bind("Name")%>' runat="server"> </asp:TextBox> </EditItemTemplate></asp: TemplateField><asp:TemplateField HeaderText="User Id"> <ItemTemplate> <asp:Label ID="lblUserId" Text='<%# Eval("UserId") %>' runat="server"> </ItemTemplate> </asp:TemplateField></asp: TemplateField>
In this example we want to edit the Name and userId is only for display.
What kind of email newsletter would you prefer to receive from CodeAsp.Net?18