View Full Version : listbox text

08-10-2005, 02:20 PM
Hi I wanted to get the text from the selected items in a list box, the value of the list box item is already being used to obtain the key of the value selected. I know in asp.net you can get the text by using the .text method but is tere a way in asp to do the same? Thanks for any input

08-10-2005, 03:11 PM
This seems like more like a DHTML/Javascript DOM question than an ASP question. I would suggest you look into the getElementById() function coupled with the .value property of the element the first finction returns.


var html_element = getElementById("list_select");
var values = html_element.value;

Don't quote me on the syntax though ;)

08-10-2005, 04:26 PM
thanks for the reply... but will this return the value of the option instead of the text? thanks

08-10-2005, 04:40 PM
when you ahve a reference to the option-object, in javascript, you can get the text by optionreference.text. Asp can get just the posted value, not the text within the optiontags

08-11-2005, 01:18 AM
With classic ASP you can't really get the text. But on the page that you need it of course you could simply get the text straight from the database table based on the ID...