Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Binding a Collection to a DataGrid


Message #1 by karlpierburg@h... on Thu, 18 Oct 2001 21:05:51
I've solved my first problem, but created a new one.  The solution to my 
first problem was that I didn't turn off the AutoGenerateColumns property 
of the DataGrid control.  Once I did that, I no longer recieved an error 
on the bind, but I also didn't generate any data.  

I know the solution is to add a bound column, like so:

        Dim z As New BoundColumn()
        z.DataField = "Name"
        z.HeaderText = "Name"

        DataGrid.Columns.Add(z)


Now the error I get when I load the page is " field or property with the 
name 'Name' was not found on the selected datasource".  If you look at the 
example in the above post, I'm binding my DataGrid to a collection of 
structures, which contains a propery called "Name".

I'm really stuck, any ideas?  Thanks

  Return to Index