Making a business objects collection grid-bindable

  • Thread starter Marc Scheuner [MVP ADSI]
  • Start date
M

Marc Scheuner [MVP ADSI]

Folks,

Has anyone done this before? (I'm sure some of you guys have)

I'd like to make sure our business objects and collections thereof are
created in such a way that we can connect them to a datagrid just as
easily as a DataSet/DataTable.

What interfaces does the business object have to implement? Which
interfaces must the business object collection implement?

Any good tutorials on this out there??

Yes, I know - we *could* convert everything into a ADO.NET DataTable /
DataSet - seems a bit silly to do so, though - there must be a way to
provide the necessary functionality directly, by implementing the
right set of interfaces, no? :)

Marc

================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
N

Nicholas Paldino [.NET/C# MVP]

Marc,

All you need to do is implement the IBindingList interface on your
collection object, and you should be able to bind your collections to the
grid easily.

Hope this helps.
 
M

Marc Scheuner [MVP ADSI]

Hi Nicholas,
All you need to do is implement the IBindingList interface on your
collection object, and you should be able to bind your collections to the
grid easily.

Okay, thanks - just out of curiosity - if I try to create a general
purpose control to export the data bound to a grid to e.g. Excel, and
I have it bound to a collection of my own (not a DataTable), how can I
then find out about the "columns" in my underlying data?

For a DataTable, I have the "Columns" property, which contains all
info needed - how is this handled for a custom object collection that
I bind to a grid?

It seems to my just the IBindingList interface can't possibly contain
all the methods and all the information needed, or am I mistaken?

Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 

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

Top