Problem populating dropdown in javascript

  • Thread starter Nicolas Bottarini
  • Start date
N

Nicolas Bottarini

Hi:
I am populating a dropdown via javascript (i have 2 dropdowns, one
with info from the DB and when you click on an item it is moved to the
other one via javascript). How i can get the items of the second
dropdown at server side? I also have to maintain state of the 2
dropdowns when the user submits the page.

Thanks you very much

Nicolas
 
K

Kevin Spencer

You get the items of the second drop-down the same way you get items from
any drop-down. Let's say you had a regular drop-down, and it had 10 items in
it. The user selects the 10th item in the list. What is the value of
Request.Form(drop-downlistName)? It's the value of the selected item. If
more than 1 item is selected, all the values are passed as an array.


So, in case you still haven't figured it out by now, you have to use
JavaScript to select all the items prior to PostBack. :)

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
N

Nicolas Bottarini

The problem is that i can't do Request.Form(DropDownListName) because
my dropdown is inside a templated control so the namingspace change and
if i use de clientID property it isn't the same as the one that is
posted back.
 
K

Kevin Spencer

The ID property isn't posted. The Name property is.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
N

Nicolas Bottarini

the clientID property is something like ctl0:ctl1:myControl, the name
property is myControl and the post var is ctl0_ctl1_myControl.

That's the problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,172
Latest member
NFTPRrAgenncy
Top