Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Building Controls / November 2006

Tip: Looking for answers? Try searching our database.

Binding a single object to a control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
paul.hester@gmail.com - 01 Nov 2006 05:25 GMT
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
Brennan Stehling - 02 Nov 2006 14:41 GMT
You can use FormView or DetailsView controls.

http://msdn2.microsoft.com/en-us/library/fyf1dk77.aspx
http://msdn2.microsoft.com/en-us/library/s3w1w7t4.aspx

There is a good Design-Time support to help you attach the properties
to the controls so you can display them.

Brennan Stehling
http://brennan.offwhite.net/blog/

> Hi all,
>
[quoted text clipped - 11 lines]
>
> Paul
kferron - 15 Nov 2006 23:50 GMT
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.

On Oct 31, 9:25 pm, paul.hes...@gmail.com wrote:
> Hi all,
>
[quoted text clipped - 11 lines]
>
> Paul

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.