In ASP. the Bind and Eval labels introduced in NET 2.0 simplify DataBinder in 1.1. eval. in most cases, you will not notice the major differences between the two new tags. However, you may find that the code generated by the VS editor on the design interface uses Bind by default, there may be two main reasons:
Eval binds Data Using Reflection on the backend, so the speed is slow.
Eval is usually used to display read-only data. Bind supports direct integration with controls such as xxxDataSource.
Maybe the Bind is based on this consideration (Automatic Binding of Update and other methods), similar to the following method will not work as we think:
1: Text = '<% # Bind ("ApplicationName") + "-" + Bind ("WorkItemId") %>'
The last displayed result is the Bind ("WorkItemId") result. All the preceding results, including the connection string, are omitted. as you can imagine, because the Bind tries to automatically update the database back (even if you didn't do so), the automatic update mechanism for binding multiple fields may not be able to be determined. in this case, you can use Eval instead. of course, to achieve the best performance, you should use explicit type conversion, as shown below:
1: Text = '<% # (System. Data. DataRowView) Container. DataItem) ["ApplicationName"]
2: + "-" + (System. Data. DataRowView) Container. DataItem) ["WorkItemId"] %>'
Note: The preceding example assumes that the data source is a weak DataSet.