Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 dropdownlist selectedvalue

Author  Topic 

leion
Starting Member

2 Posts

Posted - 2004-04-08 : 11:33:49
can anyone teach me how to implement a selected option into a dropdownlist by using javascript? i've return a value by using showmodaldialog and now i'm facing a problem to change the selected option in the dropdownlist with the value i get. any help will be appreciate. thanks

SamC
White Water Yakist

3467 Posts

Posted - 2004-04-08 : 12:07:30
[code]
<select NAME="MyList">
<option VALUE='0' selected> All Items
<option VALUE='1811'>Red is Great
<option VALUE='1812'>Blue is Better
</select>
[/code]

I avoid JavaScript whenever possible. Use server-side to insert the "select" in the list.

Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-04-08 : 12:41:30
Sam, what he's saying is he's got a modal dialog, and when that dialog returns, he wants to use JS to select the correct thing.

I think I can help with that. You need to manipulate the selectedIndex of the drop down list. I think what you have to do is loop through the items in the drop down, find the one that matches what was selected in the modal dialog, and then set the selectedIndex to the ordinal posistion of that item.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page
   

- Advertisement -