ASP.NET Framework provides a static method that calculates the subsequent binding data binding expression and optionally formats the result to a string. DataBinder.eval method.
DataBinder.eval is very convenient, because it eliminates many explicit conversions that developers must do for forced to convert values to desired data types. This is especially useful when the controls within the data binding template list, as the usual data lines and data fields must be converted.
But DataBinder.eval will bring significant performance loss to standard data binding syntax, because it uses later binding reflections, pay attention to this is important. Be cautious when using DataBinder.eval, especially when a string format is not required.
The following example demonstrates data binding using standard data binding syntax and DataBinder.eval methods, respectively.
In this case, integers will be displayed as a currency string.
<% - Standard data binding syntax, please add system.data namespace reference in * .aspx page -%>
<% # String.format ("{0: C}", (DATAROWVIEW) Container.DataItem) ["Integerue"])%>
<% - DataBinder.eval -%> <% # DataBinder.eval (Container.DataItem, "INTEGERVALUE", "{0: C}")%>