PC Review


Reply
Thread Tools Rate Thread

DataGridView - custom collection object

 
 
Rob
Guest
Posts: n/a
 
      9th Jan 2009
Hi all,

I have my own collection object which implements ienumerable and
inerator.

The collection object holds a number of "Request" objects (another
custom object).

The problem I've run into is when I databind my collection to the
gridview.

I have this line to set up the bound fields:

dgvRequests.Columns.Add(CreateBoundField("UserID"))

which works nicely....

The problem is that I want to change my Request object to hold a
"User" object which will have its own properties... so in the above -
can I do something like this?

dgvRequests.Columns.Add(CreateBoundField("User.Username"))

for example, or will the . not be recognised? If that's the case,
does that mean I'll have to put all of the properties I want to extend
from Request.User etc into Request?

ie,

User.Forename
User.Surname

are both properties of User

But to access them in the gridview using the Request object as the
enumerator, do I have to expose them like this:

Request.UserForname - which would return Request.User.Forename etc?

Any help would be appreciated... I'm trying not to change the
structure of my objects to much as so far its all been plain sailing
but using the gridview to expose data from these objects has proved a
little troublesome...

Kind regards

Rob Meade
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Business Object Collection And DataGridView Claude Microsoft C# .NET 4 8th Apr 2008 09:04 AM
DataGridView - Custom Collection - Remove New Row from Collection =?Utf-8?B?V2ViYmVydA==?= Microsoft Dot NET 0 8th Sep 2006 12:09 PM
DataGridView - Custom Collection - Remove New Row =?Utf-8?B?V2ViYmVydA==?= Microsoft Dot NET Framework Forms 0 7th Sep 2006 03:12 PM
DataGridView binding problem with custom collection =?Utf-8?B?U3R1YXJ0?= Microsoft Dot NET 4 23rd Jul 2006 11:54 PM
Re: Custom serialization on a custom object collection black_cat Microsoft VB .NET 0 3rd Jan 2005 08:30 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:46 AM.