DataGridView - custom collection object

R

Rob

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top