-2

Possible Duplicate:
Understanding asp.net Eval() and Bind()

    <asp:DataList ID="DataList1" runat="server" DataKeyField="CustomerID" 
    DataSourceID="SqlDataSource1">
    <ItemTemplate>
        CustomerID:
        <asp:Label ID="CustomerIDLabel" runat="server" 
            Text='<%# Eval("CustomerID") %>' />

    </ItemTemplate>
</asp:DataList>

Whats the difference between Eval and Bind?

Community
  • 1
  • 1
WithFlyingColors
  • 2,650
  • 4
  • 20
  • 25

4 Answers4

3

The Eval method evaluates late-bound data expressions in the templates of data-bound controls such as the GridView, DetailsView, and FormView controls and the Bind method is typically used with input controls such as the TextBox control rendered by a GridView row in edit mode.

UsmanShabbir
  • 101
  • 1
  • 4
2

Have you searched for the answer before asking?

Eval is a protected method defined on the TemplateControl class, from which the Page class is derived. Bind is a new ASP.NET 2.0 databinding keyword. It's not a method of any specific class.

Eval is used for unidirectional (readonly) data binding, while Bind is for bi-directional (editable) databinding.

Ruslan
  • 9,927
  • 15
  • 55
  • 89
1

Eval is used in read only way... so only take the data and display it. Bind is user for two ways databinding...

2GDev
  • 2,478
  • 1
  • 20
  • 32
1

It means the Label CustomerIDLabel will get the Value from the Database where the Column name is CustomerID