Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 7th, 2006, 11:08 PM
Authorized User
 
Join Date: Mar 2004
Location: Mesa, AZ, USA.
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default Databinding a Generic Collection to a Datagrid

Hi everyone and thanks in advance for all possible answers.

I'm having an issue here where I want to load a generic collection to a datagrid on run-time. I keep getting the "no default member" found error.

Below is a basic idea of what I would like to do.

[u]PersonClass.vb</u>
Code:
'--Member Variables
Private m_firstName As String
Private m_lastName As String

'--Public Properties
Public Property FirstName() As String
    '--get and set m_firstName

Public Property LastName() As String
    '--get and set m_lastName
[u]People Collection</u>
A generic collection of type PeopleClass

Now, when coding using the collection, I can access the individual properties of PeopleClass as so:

Dim People As PeopleCollection

People(0).FirstName = "John"
People(0).LastName = "Doe"
People(1).FirstName = "Jane"
People(1).LastName = "Doe"

Now when I create a datagrid and set my datasource to PeopleCollection, and within the datagrid using Container.DataItem("FirstName") and Container.DataItem("LastName"), if get the "no default member found" error when trying to databind.

Does anyone know if theres more you're suppossed to do to allow generic collections in datagrid's?

Thanks.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Generic collection population from database micmit C# 2005 7 September 19th, 2006 05:53 AM
databinding for datagrid? drachx General .NET 5 October 28th, 2004 03:21 AM
selected column databinding with collection joberoi General .NET 2 March 19th, 2004 03:52 AM
ArrayList DataGrid databinding celades C# 0 October 9th, 2003 06:39 AM
DataGrid ArrayList DataBinding celades .NET Web Services 1 October 9th, 2003 06:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.