You don't have to worry about the data source (Dataread or dataset) when using DataBinder.eval. You don't have to worry about the type of data. eval will convert this data object to a string. A lot of work was done on the underlying binding, using reflection capabilities. Just because it is convenient to use, it affects data performance. When bound to a dataset, DataItem is actually a DataRowView (if it is bound to a data reader (dataread), it is an IdataRecord.) Therefore, directly converting it to a DataRowView will greatly improve performance.
Note when using: 1. Pay attention to the case of field names (pay special attention). If it is inconsistent with the query, in some cases it will be slower than <%# DataBinder.Eval(Container.DataItem, "field name") %>. 2. If you want to further improve the speed, you can use the <%# ((System.Data.DataRowView)Container.DataItem)[0] %> method. However, its readability is not high.
//When using DataSet as the data source
//Normal situation (C#)
<%# ((System.Data.DataRowView)Container.DataItem)["Title"] %>
//Bind date field format string
<%# Convert.ToDateTime(((System.Data.DataRowView)Container.DataItem)
["FbTime"]).ToString("yyyy year MM month dd day") %>
<% # DataBinder.Eval(Container, "DataItem.FbTime","{0:yyyyMMmonthddDay}") %>
//String binding exceeds the specified length and is truncated
<%# DataBinder.Eval(Container.DataItem, "Text").ToString().Trim().Length>7?
DataBinder.Eval(Container.DataItem, "Text") .ToString().Trim().Substring
(0,7):DataBinder.Eval(Container.DataItem, "Text").ToString().Trim() %>
//Convert the price to 2 decimal places
<%# Convert.ToDecimal(((System.Data.DataRowView)Container.DataItem) ["Price"]).ToString("F2") %>
<%# DataBinder.Eval (Container, "DataItem.Price","{0:F2}") %>
'Judge after price formatting in VB.net
<%# IIf(DataBinder.Eval(Container.DataItem, "price","{0:F2}")="0.00","Negotiable",DataBinder.Eval(Container.DataItem, "price","{0: F2}")+"万") %>
'Vb.net General
<%# Ctype(Container.DataItem,DataRowView).Row("Title") %>
http://www.cnblogs.com/wintersun/archive/2006/08/11/474135.html