[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

Binding to a datagrid

no

4/21/2008 7:14:00 AM

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?


1 Answer

Jack Jackson

4/21/2008 5:07:00 PM

0

On Mon, 21 Apr 2008 09:13:52 +0200, "Khan" <no@spam.me> wrote:

>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.