当前位置: 代码迷 >> ASP.NET >> 字符串有关问题
  详细解决方案

字符串有关问题

热度:2681   发布时间:2013-02-25 00:00:00.0
字符串问题!
如何取ListBox 中多个被选中的值 ,用逗号分割
构造成一个字符串?

存入数据库时如何将其分拆
分别存入数据库中?

------解决方案--------------------------------------------------------
C# code
protected void Button1_Click(object sender, EventArgs e)    {        //获得选中的索引数组        int[] select = this.ListBox1.GetSelectedIndices();        //控件集合        ListItemCollection items = this.ListBox1.Items;        string str = "";        foreach (int i in select)        {            str += items[i].Value + ",";        }        Response.Write("<script>alert('"+str+"')</script>");    }
  相关解决方案