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 / Web Controls / September 2004

Tip: Looking for answers? Try searching our database.

Dropdown list control problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jerry - 29 Sep 2004 21:34 GMT
I have a dropdown list and I am linking it to a database
table called "Product".  The fields in the database are
ProductID (PK), price, and description.  I am assigning
the description field from the DB to the text field (what
gets displayed) in the dropdown.  I am assigning the
price from the DB to the Value in the dropdown list.  

Data:
the second item in the list has a price of 10.00 and the
fourth item in the list also has a price of 10.00.  All
of the other prices are different.

Problem:  When you click the fourth item the second item
is displayed.  So it appears that .NET is using the value
field and displaying the first record it sees with that
value rather than using the index of the dropdown list.  
This seems to me to be a .NET bug.

Any ideas?

Thanks,

Jerry
Robert Koritnik - 30 Sep 2004 09:46 GMT
You never get the index. DropDown list's property SelectedItemIndex gets set
according to value field returned.

You could either:
1. inherit this control and appropriately set SelectedItemIndex acording to
Value & Text

2. It's actually strange to put something nonunique in the Value filed.
Change the Value field or concat it with a unique value and split both
values on the server to get the correct item index.

Signature

RobertK
{ Clever? No just smart. }

> I have a dropdown list and I am linking it to a database
> table called "Product".  The fields in the database are
[quoted text clipped - 19 lines]
>
> Jerry

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.