Thursday, February 10, 2011

DataBinder.Eval versus Explicit Casting


http://unboxedsolutions.com/sean/archive/2005/03/06/455.aspx


DataBinder.Eval versus Explicit Casting

As a regular DataBinder.Eval() user, now I feel a little bit guilty after reading this KB article, and I'm curious how many ASP.NET developers use explicit casting on a regular basis. Drop me a line and let me know.
Let's say you are binding to a DataSet. This...
<%# ((System.Data.DataRowView)Container.DataItem)["au_id"] %>
...is significantly faster than this...
<%# DataBinder.Eval(Container.DataItem, "au_id") %>

No comments:

Post a Comment