我在页面的Page_Load 中加入了以下语句: 
Button1.OnClientClick = "window.open('search.aspx?type=' + document.getElementById('" + TextBox1.ClientID + "').value,'_blank');return false;"; 它能正确地获得TextBox1的值并进行传递,现在我想获取CheckBoxList  RadioButtonList  中的值该怎么办,而且这句话只是传递了一个参数,要传递多个参数该怎么写,小弟愚钝呀,不会弄~~~

解决方案 »

  1.   

    js获取CheckBoxList中的值可以参考
    http://blog.csdn.net/jingshuaizh/archive/2008/03/14/2181384.aspx传递多个参数直接用 & 连接啊
      

  2.   

    CheckBoxList会比较麻烦,因为你不能肯定用户选了几个
    RadioButtonList和DropDownList会好些
      

  3.   

    建议 checkbox 用html 不用服务器控件  <input type='checkbox' name='checkbox1'> 只要name保持一致就可以用 Request.Form["checkbox1"] 取到所有被选中的值了,这些值用 , 隔开的。
      

  4.   

    传递多个参数,还是拼一个字符串:
    string queryScript = string.Format("window.open('search.aspx?type=' + document.getElementById('{0}').value + '&p2=' + document.getElementById('{1}').value,'_blank');return false;",
                TextBox1.ClientID,
                TextBox2.ClientID);
    Button4.OnClientClick = queryScript;
      

  5.   

    最好把HTML控件加上runat="server" 转成HTML服务器端控件,这样在Page_Load 直接遍历获取CheckBoxList的值for(int i=0;i<CheckBoxList.Item.Count-1;i++)
    {
       if(this.CheckBoxList.Item[i].Selected)
       {
          Response.Write(this.CheckBox.Item[i].Text);
       }
    }
    要传多个值第一个值后面加个"&"再加你的参数就OK
      

  6.   

    CheckBoxList如果选项多就很麻烦
    要判断哪些被选中
    可能要传很多个参数RadioButtonList比较方便 只要传一个值
      

  7.   

    Button1.OnClientClick = "window.open('search.aspx?type=' + document.getElementById('" + RadioButtonList1.ClientID + "').Selectvalue,'_blank');return false;";