473,382 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Dotnet bug? (asp dropdown list)

I have identified a re-creatable issue that may be a bug
and may be by design?

I have a Webform with two dropdown lists on it, each with
a different name and different tab index but they both
have the same data. I populate them by using listitems
which are then set to nothing afterwards (see code
extract below). However, because I am adding the same
sourceitem to both controls they then seem to be treated
as one object and any attempt to edit one. edits the
other....Let me demonstrate

----------------------
(form contains unbound dropdown lists - lstUserDepartment
and lstRequesterDepartment)

dim lstItem as listItem

lstitem = new listitem
lstitem.value = 1
lstitem.text = "Brighton"
lstUserDepartment.items.add (lstItem)
lstRequesterDepartment.items.add (lstItem)
'should be harmless enough...
lstitem=nothing

lstitem = new listitem
lstitem.value = 2
lstitem.text = "Paris"
lstUserDepartment.items.add (lstItem)
lstRequesterDepartment.items.add (lstItem)
lstitem=nothing

etc....

Now later in the code when Im trying to set the values..

lstUserDepartment.items.findbyvalue(myrecordset.fi elds
("UserDept").value).selected=true

This line changes BOTH listboxes to the same selected
item. And the next line..

lstRequesterDepartment.items.findbyvalue
(myrecordset.fields("requesterDept").value).select ed=true

....generates an error "A droplist cannot have multiple
lines selected". This is telling me that both objects are
now refering to the same physical memory space.

I know there is a workaround which is basically to create
two seperate listitem collections containing the same
data and assigning one to each control but this is a
waster of memory/resources...
Nov 17 '05 #1
1 1831
Hi,
i had the same issue using AddRange method on Items .. i do a loop and
adding one by one the different items do work well..

Thank you for reporting the bug

Alexandre puissant
"Paul Eason" <pe*********************@remove.ntlworld.com> wrote in message
news:03****************************@phx.gbl...
I have identified a re-creatable issue that may be a bug
and may be by design?

I have a Webform with two dropdown lists on it, each with
a different name and different tab index but they both
have the same data. I populate them by using listitems
which are then set to nothing afterwards (see code
extract below). However, because I am adding the same
sourceitem to both controls they then seem to be treated
as one object and any attempt to edit one. edits the
other....Let me demonstrate

----------------------
(form contains unbound dropdown lists - lstUserDepartment
and lstRequesterDepartment)

dim lstItem as listItem

lstitem = new listitem
lstitem.value = 1
lstitem.text = "Brighton"
lstUserDepartment.items.add (lstItem)
lstRequesterDepartment.items.add (lstItem)
'should be harmless enough...
lstitem=nothing

lstitem = new listitem
lstitem.value = 2
lstitem.text = "Paris"
lstUserDepartment.items.add (lstItem)
lstRequesterDepartment.items.add (lstItem)
lstitem=nothing

etc....

Now later in the code when Im trying to set the values..

lstUserDepartment.items.findbyvalue(myrecordset.fi elds
("UserDept").value).selected=true

This line changes BOTH listboxes to the same selected
item. And the next line..

lstRequesterDepartment.items.findbyvalue
(myrecordset.fields("requesterDept").value).select ed=true

...generates an error "A droplist cannot have multiple
lines selected". This is telling me that both objects are
now refering to the same physical memory space.

I know there is a workaround which is basically to create
two seperate listitem collections containing the same
data and assigning one to each control but this is a
waster of memory/resources...

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: news | last post by:
Hello, I need help with the following problem: An HTML page that have two dropdown list whit different values: 1. Dropdown list 1(tblname1) =values with different location's. After user...
0
by: Paul Eason | last post by:
I have identified a re-creatable issue that may be a bug and may be by design? I have a Webform with two dropdown lists on it, each with a different name and different tab index but they both...
2
by: Harry | last post by:
Hi, Quick question regarding dropdownlists. On one page I have 10 asp:dropdownlists. The user selects an option from a dropdown list and then it updates an asp:label with the relevant text....
3
by: | last post by:
guys i have a asp.net form with a ton of dropdown boxes and i need to accomplish two things on the client with no post back to server. im also thinking that my answer lies in using javascript, but i...
6
by: Jenna Alten | last post by:
I have a datagrid with a template column that contains a dropdown list. I currently fill and display the dropdown list on the page load. This is working correctly. I am NOT using an Edit Column. I...
6
by: tfsmag | last post by:
I have a Grid that I've set up to have two of the fields use dropdownlists while in edit mode. Now I can bind the data to the dropdownlists just fine. My problem is that the second dropdown depends...
7
by: kelly | last post by:
Hi I have an app where I have 2 dropdown lists (state and city) and a Save button. When a user selects a value from the state dropdown list, I use script callback to populate the data for the...
3
by: er1 | last post by:
Hi all, I have created a double dropdown list. Based on the first list selection, second list populates (this works fine). I have a submit button, which when clicked should run a select query...
1
by: luvkling | last post by:
hi, i am new to asp.net. i currently doin a website. i created a add form in this form the user need to add in the record n when they press the submit button it will add the record into the access...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.