listbox可以选多项,但是如何读取它被选中的各个项呢?

解决方案 »

  1.   

    foreach(ListItem oItem in ListBox1.Items)
    {
    if(oItem.Selected)
    {
    Response.Write(oItem.Value+"<BR>");

    }
    }
    =============
    我的签名
      

  2.   

    foreach(ListItem oItem in ListBox1.Items)
    {
    if(oItem.Selected)
    {
    Response.Write(oItem.Value+"<BR>");

    }
    }
    =============
    我的签名
      

  3.   

    a.SelectedValue循环度曲
    dim i as integer
    for i=0 to a.items.count-1
        response.write (a.Items(i).Value)
    next
      

  4.   

    foreach(ListItem oItem in ListBox1.Items)
    {
    if(oItem.Selected)
    {
    Response.Write(oItem.Value+"<BR>");

    }
    }
      

  5.   

    for( int i=0;i < ListBox1.Items.Count; i ++ )
    {
    if( ListBox1.Items[i].Selected )
    {
    Response.Write( " 当前选定的项值为:" + ListBox1.Items[i].Text + "<br>");
    }
      

  6.   

    象ListBox1.Items.Count、ListBox1.Items[i]这样的,最好能定义个变量,这样效率会高一些