Binding a single object to a control

P

paul.hester

Hi all,

This probably sounds like a stupid question, but what is generally the
recommended way to display a business object in the aspx file for an
object fetched in the code behind file?

Normally I've been fetching the object in the code behind and exposing
the object's properties that I need as Page properties, but I'd like to
know if there's a better way to do it - e.g. is there a good way of
binding an object (i.e. not a data set/collection etc.) to a control
and displaying the properties that way.

Thanks in advance,

Paul
 
K

kferron

If i understand you correctly, you're actually trying to show all of
the values of a business object in some display?

Lets say you have a Customer, are you looking for a way to have a
control that binds directly to Customer?

In my opinion, even though it seems superfluous, one of the easy ways
to do this is make a Collection<Customer> with just the single customer
reference in it. Then Databind the collection to DetailsView with
AutoGenerateColumns=true.

This gives you a spit out of the current object, and is by no means
glamorous, but does allow for a 'propertygrid' feel directly on your
custom type.

hope this helps.
 

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,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top