查了半天也没能查到正确的方法那位帮下忙。

解决方案 »

  1.   

    you   need   to   go   through   each   item   
        
      foreach   (ListItem   li   in   YourListBox.Items)   
      {   
          if   (li.Selected)   
              ....   
      }   
        
      or   
        
      string[]   s   =   Request.Form.GetValues(YourListBox.UniqueID);
      

  2.   

    string[]   s   =   Request.Form.GetValues(YourListBox.UniqueID);可能有问题,没有测试
      

  3.   

    服务器控件ListBox:
    this.ListBox1.selectitem.text;
    HTML控件;
    function getText()
    {
    document.getElementById("select1")
      

  4.   

    服务器控件ListBox:
    this.ListBox1.selectitem.text;
    HTML控件;
    function getText()
    {
    var select1=document.getElementById("select1");
    alert(select1options[select1selectedIndex].text);
    }
    刚刚没写完,BOSS来了
      

  5.   

    alert(select1options[select1.selectedIndex].text);
      

  6.   

    TextBox1.Text = ListBox1.SelectedItem.Text;
    TextBox2.Text = ListBox1.SelectedItem.Value;上面的代码放到一个按钮的单击事件中,首先你的ListBox中要有项可供选择
      

  7.   

    -_-!!!BOSS来也不让上CSDN?我要从服务器端获取,不是从客户端获取我试了,,假如listbox是自己设定值的话,可以读出来但我现在是从数据库读取,再绑定到 listbox ,就读不出来值了很是奇怪~~
      

  8.   

    为什么我可以啊,你是不是用的服务器控件ListBox,在SelectedIndexChanged事件中写的代码?AUTOPOSTBACK属性有没有改为TRUE
      

  9.   

    我的代码如下:foreach (ListItem li in hy1.Items)
            {
                if (li.Selected)
                {
                   Response.Write(li.Value.ToString());
                }
            }
      

  10.   

    解决了~~~是因为我把数词库中的数据绑定到 listbox 的时候写成了一个函数,当page_load的时候载入这个函数,忘记加 !ispostback 了。。汗~,不好意思,马上结帖~~