读书人

在javascript方法中怎么取得页面中Dro

发布时间: 2012-04-23 13:17:38 作者: rapoo

在javascript方法中如何取得页面中DropDownList选中的值???
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.DropDownList1.DataSource = new PartManager().GetAll();
this.DropDownList1.DataTextField = "PartName";
this.DropDownList1.DataValueField = "Id";
this.DropDownList1.DataBind();

}
}

页面中绑—ropDownList。

<script language="javascript" type="text/javascript" >
function mytest2() {
var part = null;
var dropdownlist = document.getElementById("DropDownList1");
</script>
想取得选中项的DataValueField接着怎么写???

[解决办法]
dropdownlist.options[dropdownlist.selectedIndex].value;
试试

读书人网 >ASP

热点推荐