Binding to a datagrid

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?
 
J

Jack Jackson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top