View Single Post
  #4 (permalink)  
Old March 8th, 2009, 02:28 AM
Lee Dumond's Avatar
Lee Dumond Lee Dumond is offline
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

You're welcome. Thanks button is on the right -->

The way I showed is better, because it takes advantage of the fact that SqlDataSource works with the DataView by default, and thus each DataItem can be safely cast to a DataRowView.

On the other hand, DataBinder.Eval uses reflection to determine whether the DataItem should be a DataRowView or a DbDataRecord. Reflection is a rather slow process, so it's worthwhile to avoid it if you can.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
The Following User Says Thank You to Lee Dumond For This Useful Post:
chobo2 (March 8th, 2009)