OO programming and datagrids

R

Russell

Hello there,

I am building a web system with a 3 tiered design (DAL / BLL and pres
layer). I have all my objects (ie... USER object for example) and
collection objects that build up collection of my objects.(ie
...userCollection object.) This is all well and good but when I come to
binding a collection of my user objects to a datagrid which requires
sorting paging..etc... it seems that the easiest way is to ignore my
collection of user objects and just return a straight dataset of my
user objects from the database. This is easy but I am not satisfied as
I don't want to move away from my OO design.

So my question is, how do I bind a collectionBase of user objects to a
datagrid and allow sorting, paging etc... without an horrendous amount
of coding.

your suggestions are much appreciated.

thanks
RuSs
 
W

William Gower

Why do you think that using a dataset is not Object-Oriented? I use custom
classes for when I am returning a single record and datasets for returning
multiple records for listboxes, combo boxes and data grids.
 
S

Stephen B. Hahn

This can be done. You must implement the IBindingList interface for the
objects you want to bind to the grid. This interface is only implemented
in the Dataview and DataViewManager classes in the .NET Framework, which
work with DataTables. When a DataTable is bound to a control a default
DataView object is used to actually do the binding.

This is a fairly big interface, 9 Properties, 6 Methods and 1 Event. If
possible you might want to create a facade that encapsulates the heavy
lifting.
 

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