Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Dropdown list control problem

Reply
Thread Tools

Dropdown list control problem

 
 
Jerry
Guest
Posts: n/a
 
      09-29-2004
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


 
Reply With Quote
 
 
 
 
Robert Koritnik
Guest
Posts: n/a
 
      09-30-2004
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.

--
RobertK
{ Clever? No just smart. }

"Jerry" <(E-Mail Removed)> wrote in message
news:3dc801c4a663$b5765220$(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ajax cascading dropdown: second dropdown disabled acadam ASP .Net 0 12-27-2006 10:59 AM
bind a dropdown in a column in a datagrid based on the dropdown value selected in another column of the datagrid. vishnu ASP .Net 1 03-25-2006 01:24 PM
Setting background list item color in dropdown list control M. Craig ASP .Net Web Controls 1 01-09-2004 03:32 AM
Select dropdown box bleeds into Javascript dropdown menu Mike HTML 1 12-18-2003 09:49 PM
Problem repopulating DropDown List control Manish ASP .Net 0 08-12-2003 08:36 PM



Advertisments