ListBox控件用javascript添加数据后在服务器上获取不到.
添加多行数据后在服务器上还是count=0.
应该怎么解决????

解决方案 »

  1.   


    protected void btnQueDing_Click(object sender, ImageClickEventArgs e)
        {
            for (int i = 0; i < ListBox1.Items.Count; i++)
            {
                string aa = ListBox1.Items[i].Text;
                
            }
        }
      

  2.   

    JavaScript 已经加入数据 但提交后获取不到了
      

  3.   

     <asp:ListBox ID="ListBox1" runat="server" Width="521px" Height="137px"></asp:ListBox>
      

  4.   


      <asp:ListBox ID="ListBox1" runat="server" Width="521px" Height="137px"></asp:ListBox>
    这个下面确定有子项?
    protected void btnQueDing_Click(object sender, ImageClickEventArgs e)
      {
         for (int i = 0; i < ListBox1.Items.Count; i++)
        {
          string aa = ListBox1.Items[i].Text;
        }
      }还有你这句话。不是只获取到最后一个的值了么?
    string aa +=ListBox1.Items[i].Text ;
      

  5.   

    难道又是没加!ispostback的问题?使页面重新加载了?
      

  6.   

    foreach(ListeItem item in ListBox1.Items)
    {
        
    }
      

  7.   

    既然用的是服务器控件,我的看法是这个地方用ajax从服务器端添加 ListBox 的 item
      

  8.   

    必须使用Request.Form[ListBox1.UniqueID]获取
      

  9.   

    解决方案,把listbox的值保存在 隐藏域中,然后读隐藏域