Error: DataBinding System.Data.DataRowView does not contain a property with the name …

September 5th, 2008 | Tags:

If you ever tried or try to bind an Repeater control with a data source that have a period or dot in its one/more data item’s name then you might receive a error while binding the property using DataBinder.Eval method.

For Example, I was trying to do a simple thing with Asp Repeater control (which is bind to a DataTable). Please see the following piece of code


<%# DataBinder.Eval(Container.DataItem, “alt.price”)%>

Here is a column name “alt.price” in the data source (DataTable) . But the above line was resulting an error as follows

DataBinding: ‘System.Data.DataRowView’ does not contain a property with the name ‘alt’

To resolve this issue I used a new Method ‘DataBinder.GetPropertyValue’ that simply retrieves property value without any evaluation on the expression while DataBinder.Eval method uses reflection to parse and evaluate a data-binding expression against an object at run-time.

Conclusion – If you don’t want that the expression to be evaluated at the run time, it’s a good practice to use GetProtperyValue method instead of Eval method.





Share and Enjoy:
  • Twitter
  • Digg
  • del.icio.us
  • StumbleUpon
  • Google Bookmarks
  • Technorati
  • Facebook
  • DotNetKicks
  • email
  • Print
  • NewsVine
  • Reddit
  • RSS
  1. V S Karthik
    February 27th, 2009 at 14:14
    Reply | Quote | #1

    I want to know the solution for the above error.

  2. Austin Higgs
    November 18th, 2009 at 19:45
    Reply | Quote | #2

    THANK YOU – this was bugging me for about 2 hours !!!!!

  3. December 3rd, 2009 at 16:14
    Reply | Quote | #3

    Hello, just wanted you to know I have added your blog to my Google bookmarks because of your fantastic blog layout (LOL). But honestly, I believe your site has one of the cleanest design I’ve came across. It honestly makes your blog post easier to read.

  4. May 30th, 2010 at 17:56
    Reply | Quote | #4

    Hi,just observed your Blog when i google something and wonder what webhosting do you use for your website,the speed is more faster than my wordpress, i really need it.will back to check it out,thanks!

  5. Adam
    April 12th, 2011 at 22:07
    Reply | Quote | #5

    Thanks I was getting this error when my column name was “Time(min)”. Using GetPropertyValue made it work.