Binding to a datagrid

  • Thread starter Thread starter Khan
  • Start date Start date
K

Khan

Ha all.
I have a my custom class with few strings. Then i have a List of
my custom class. I' m adding data to list with "mylist.Add(mycustmclass)"
I wnat to bind that list to a GridView but i get an exeption
" The data source for GridView with id 'GridView1' did not have any
properties or attributes from which to generate columns. Ensure that your
data source has content."
Where is the problem?
 
Ha all.
I have a my custom class with few strings. Then i have a List of
my custom class. I' m adding data to list with "mylist.Add(mycustmclass)"
I wnat to bind that list to a GridView but i get an exeption
" The data source for GridView with id 'GridView1' did not have any
properties or attributes from which to generate columns. Ensure that your
data source has content."
Where is the problem?

It sounds like your custom class doesn't have any Properties. Binding
works only with Properties, not Fields.

Also, you should use the generic BindingList for the list, as it has
more binding capability than List or ArrayList.
 
Back
Top