.Net ramblings
# Wednesday, 21 December 2005
GridView Databinding error "Field or property ... not found on the selected data source"

A field or property with the name 'xyz' was not found on the selected data source

I get this error when i bind a GridView to an array of custom objects with public variables. 
The recommended pattern for designing classes is to have private variables with public properties with get/set etc, but for my current application i'm not bothering with that. Apparently because of the Reflection methods used in GridView databinding, you have to have properties to bind fields in the GridView to your object fields. 

bit of a pain.


Wednesday, 21 December 2005 15:51:28 (GMT Standard Time, UTC+00:00)  #    Comments [3]  Asp.Net