当前位置: 代码迷 >> ASP.NET >> DropDownList控件
  详细解决方案

DropDownList控件

热度:3216   发布时间:2013-02-26 00:00:00.0
高手指点DropDownList控件?
ASP.NET里的DropDownList控件的集合中的每一项不是有2个值吗?一个TEXT,一个VALUE,取VALUE可以这样取值DropDownList1.SelectedValue      
我想请问下,取TEXT的值怎么取,
在就是请指导在后台代码怎么取,
在前台JavaScript里怎么取这两个的值,请依次说明。给出相关代码,谢谢!

------解决方案--------------------------------------------------------
javascript:
var list=document.getElementById( "DropDownList1 "); //DropDownList的ID号
var listindex=list.selectedIndex; //DropDownList中选中项的索引号
var v=list.options[listindex].value; //v等于DropDownList中选中项的value
var t=list.options[listindex].text;
  相关解决方案