怎样取第二个dropdownlist的值呢
mydown2.SelectedItem.Value没有取得他的值.
用Request.Form["mydown2"].ToString()也没有,请问该怎样取得第二的dropdownlist的值呢?

解决方案 »

  1.   

    可以取到呀
    private void Button1_Click(object sender, System.EventArgs e) 

    Response.Write(Request.Form["DropDownList1"].ToString()+"<br>"+Request.Form["DropDownList2"].ToString()); 
    } 或者在前台把它放到hidden里
    function getData()
    {
                        var province=document.getElementById("DropDownList1");
                        var pindex = province.selectedIndex;
                        var pValue = province.options[pindex].value;
                        var pText  = province.options[pindex].text;
                        
                        var city=document.getElementById("DropDownList2");
                        var cindex = city.selectedIndex;
                        var cValue = city.options[cindex].value;
                        var cText  = city.options[cindex].text;                    
                      
                        document.Form1.hidprovince.value=pValue;
                        document.Form1.hidcity.value=cValue;
    }<INPUT style="Z-INDEX: 106; LEFT: 8px; WIDTH: 160px; POSITION: absolute; TOP: 176px; HEIGHT: 22px" type="hidden" size="21" id="hidprovince" runat="server"><INPUT style="Z-INDEX: 107; LEFT: 184px; POSITION: absolute; TOP: 176px" type="hidden"
      id="hidcity" runat="server">string sql="insert into testgrid (province,city) ";
    sql+="values('"+this.hidprovince.Value+"','"+this.hidcity.Value+"')";
    Response.Write(sql);参考
    http://singlepine.cnblogs.com/articles/265678.html