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 / Windows Forms / WinForm General / September 2004

Tip: Looking for answers? Try searching our database.

Custom display format for databound combo box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Cory Burkhardt - 04 Sep 2004 06:26 GMT
I would like to be able to customize how data is displayed in my databound
combo box.  The user will be selecting one of these values which will
correspond to a row in the database.  However, I do not want it to display
in the selection items simple a single value from each row.  I would like
for it to display a combination of two column values.  For instance, suppose
I have this data:

ID, value1, value2
--------------------
1,  data-A1, data-A2
2,  data-B1, data-B2

And I want the combo box to display the items like this:
"data-A1 and data-A2" with value of 1
"data-B1 and data-B2" with value of 2

I could do this by selecting composite data in my original SELECT statement,
with: value1 + ' and ' + value2 as DisplayValue.  However, this won't stay
current as I update the rows in the local cache.  Is there a way to have the
databound combo box's composite display automatically update as the rows are
being modified?
Sijin Joseph - 04 Sep 2004 07:54 GMT
You can use a DataView with a column that has an expression set to the
concatentation of the two value fields.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fsystemdatadataviewclasstopic.asp

http://support.microsoft.com/default.aspx?scid=kb;EN-US;313485

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

> I would like to be able to customize how data is displayed in my databound
> combo box.  The user will be selecting one of these values which will
[quoted text clipped - 17 lines]
> databound combo box's composite display automatically update as the rows are
> being modified?

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



©2008 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.