Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use javascript to get items from server side listbox

Status
Not open for further replies.

JDAEMS

Programmer
Aug 27, 2003
84
BE
Dear sir/madam,

Is it possible to retrieve the items from a server side listbox using javascript in the code behind page?

More detailed: I have a page with a button on it. When this button is clicked a new window opens up (like a popup) where you can search for items. When you click Finish on the popup window, the idea is to write the items in the list on the popup to a list on the window that opened the popup.

This is what i ahve, but it doesn't work:

script = "<script type=""text/javascript"" > "
script += "for(i=0;i < document.frmPrompt.lstChosen.items.count;i++){ "
'script += "if(document.frmPrompt.lstChosen.Items.Selected){ "
script += "Response.Write(document.frmPrompt.lstChosen.Items.Text); } "
script += "</script>"

It says that it doesnt know the object document.frmPrompt.lstChosen.items

kind regards
Jelle
 
In the pop up page do something like this:
window.opener.forms[0].textbox1.value = "<value from source textbox>"

Of course you will have to modify this to use listboxes as you have done.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top