CompositeControl & CompositeDataBoundControl question

G

Griff

Hi

I want to create an n-tier custom server control.

The idea is that the control will determine [at run-time] which "view" will
be used. By this I mean User A may want the data displayed as a tree-view,
User B as a datagrid etc, etc.

So, I can envisage that in some circumstances it is using a data bound
control and in others a non-data bound control - who knows. In which case,
which do I inherit from - the CompositeControl or the
CompositeDataBoundControl?

Griff
 
M

Michael Hamrah

Hey Griff, both TreeView and DataGrid (GridView) are Data Bound
controls. Whenever you have a control that your binding to a
repeatable datasource (something that implements IEnumerable) go with
the CompositeDataBoundControl. It sounds like this is what you want.

Even if you were not binding to a repeatable data source (let's say you
were binding to a Detail view of a record that was shown in list) the
CompositeDataBoundControl can help you out because it has a DataSource
and other properties/methods. THis is something the CompositeControl
doesn't have. This will help your end user have a consistent API with
data related controls.

If there's Data Involved, go with CompositeDataBoundControl. It has
the necessary support for working with a datasource, whether it's
repeatable or not.

Michael Hamrah
 

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

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top