日期:2014-05-20  浏览次数:20887 次

dropdownlist的取值问题?
<script   language= "javascript ">
province   =   new   Array();
province[0]   =   new   Array( '北京市 ', '110000 ', '110000 ');
province[1]   =   new   Array( '天津市 ', '120000 ', '120000 ');
province[2]   =   new   Array( '河北省 ', '130000 ', '130000 ');
province[3]   =   new   Array( '山西省 ', '140000 ', '140000 ');
province[4]   =   new   Array( '内蒙古自治区 ', '150000 ', '150000 ');
province[5]   =   new   Array( '辽宁省 ', '210000 ', '210000 ');
province[6]   =   new   Array( '吉林省 ', '220000 ', '220000 ');
province[7]   =   new   Array( '黑龙江省 ', '230000 ', '230000 ');
province[8]   =   new   Array( '上海市 ', '310000 ', '310000 ');
province[9]   =   new   Array( '江苏省 ', '320000 ', '320000 ');
province[10]   =   new   Array( '浙江省 ', '330000 ', '330000 ');
var   ProvinceAll   =   11;
function   ChangeLocation(P)
{
  p.options[0]   =   new   Option( '请选择 ', ' ');

  for   (i=0;i   <=   ProvinceAll-1;   i++)
  {
    p.options[p.length]   =   new   Option(province[i][0],province[i][1]);
  }
}
</script>
-------------------------------------
<asp:dropdownlist   id= "ddlCity "   style= "Z-INDEX:   102;   LEFT:   472px;   POSITION:   absolute;   TOP:   120px "   runat= "server "> </asp:dropdownlist>
<SCRIPT   language= "javascript ">
      ChangeLocation( 'ddlCity ')
</SCRIPT>
-------------------------------------
ddlCity.SelectedValue获取的值是空的,要怎么获取值?

------解决方案--------------------
是的;你用js给dropdownlist填充数据的
你可以放一个hidden在那里;当dropdownlist变化后就把选择的值给hidden;然后在服务器端取hidden的值;我的是这样做的。
------解决方案--------------------
或者你Request[ "ddlCity "]也可以取到值
------解决方案--------------------
Request.Form[ "ddlCity "]
------解决方案--------------------
Request.Form[ "ddlCity "]
------解决方案--------------------
ddlCity.value
看看?
------解决方案--------------------
Request.Form[ "ddlCity "]


------解决方案--------------------
我一般先放入html的隐藏控件,再request.form[]取表单里隐藏控件值