views:

927

answers:

1

Ok, I'me getting real dumb with this one....

I have this class:

Public Class whatever
Public id as string
Public name as string
public date as string
end class

Wich I use with this code:

dim personlist as new arraylist

dim person as new whatever
person.id="1"
person.name="bozo"
person.date="6-6-6"
personlist.add(person)

and then i repeat so that i can fill my arraylist with all the information that I want to show in my gridview.

The problem is this:

gridview1.datasource = personlist
gridview1.databind()

When executing, I get an error saying :

The data source for GridView with id 'gdpersonlist' did not have any properties or attributes from which to generate columns.  Ensure that your data source has content.

Can anyone help me or perhaps point me in the right direction to do this?!

+4  A: 

Try using properties instead of fields. The data binding for the grid view won't work for fields.

Public Class whatever
  Public _id as string
  Public name as string
  public date as string

  Public Property Id As String 
    Get 
      Return _id
    End Get
    Set (value as String )
      _id = value
    End Set
  End Property

  ' repeat for all 3 fields
end class
JaredPar
Beautiful, thanks man.
v3ga