Thierry,
It renders as an HTML select element, so all the properties of the select
element are available on the client side. It does have a value property,
but this doesn't work reliably in all browsers. Using the option
represented by the selected index is a better general solution. e.g.:
var countrySelect = document.FormEditCustomer.DDListVatCountry;
if (countrySelect.selectedIndex > -1)
{
VATCheck_window = window.open('VATCheck.aspx?VATNumber=' +
document.FormEditCustomer.TBVatNumber.value + '&VATCountry?' +
countrySelect.options[countrySelect.selectedIndex].value,
'VATCheck');
VATCheck_window.focus();
}
If the VATCountry is represented in the display text of the option rather
than its value attribute, use the option's text property instead of its
value property.
HTH,
Nicole
"Thierry" <Th*****@nospam.com> wrote in message
news:y8********************@phobos.telenet-ops.be...
Hi,
Is it possible to get the value of an asp:dropdownlist in javascript. I
need to get that value to assign it to a hyperlink.
This does not work:
document.FormEditCustomer.DDListVatCountry.selecte dIndex
<script language="javascript">
function GetVatPopup()
{
VATCheck_window=window.open('VATCheck.aspx?VATNumb er=' +
document.FormEditCustomer.TBVatNumber.value + '&VATCountry?' +
document.FormEditCustomer.DDListVatCountry.selecte dIndex + '',
'VATCheck');VATCheck_window.focus()
}
</script>
Thanks,
Thierry