我想做过购物车:
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
TableBind();

}
        } public void TableBind()
{
string array=Convert.ToString(Session["web_producter"]);
string[] pro_arraylist=array.Split('P');//定义数组
int sum1=0;
Response.Write("<table border=1 width=88% bordercolorlight=#C0C0C0 cellspacing=0 cellpadding=0 bordercolordark=#FFFFFF><tr><td width=132>商品编号</td><td width=79>商品名称</td><td width=73>商品单价</td><td width=92>商品数量</td><td width=85>商品总价</td></tr>");
for(int i=0;i<pro_arraylist.Length;i++)
{
string[] pro_arraylist1=pro_arraylist[i].Split(',');
Response.Write("<tr>");
                for(int j=0;j<pro_arraylist1.Length;j++)
{
Response.Write("<td>"+pro_arraylist1[j]+"</td>");
} string sum=Convert.ToString(Convert.ToInt32(pro_arraylist1[2])*Convert.ToInt32(pro_arraylist1[3]));
Response.Write("<td>"+sum+"</td>");
sum1=sum1+Convert.ToInt32(sum);
Response.Write("</tr>");
}
string sumstr=Convert.ToString(sum1);
Response.Write("<tr><td colspan=6>"+sumstr+"</tr></td>");
Response.Write("</table>");
}商品的信息放在Session["web_producter"]中
不同的用P分隔,商品的信息为,分隔
例如:编号,名称,价钱,数量P编号,名称,价钱,数量
能实现以表格显示,
但我想可以以checkbox实现可以选择一项,多项,进行删除数组的项,急啊,在线等

解决方案 »

  1.   

    这样删除的话可能会有点麻烦的,使用 Hashtable 可能会方便一点。
      

  2.   

    我觉得还是直接用DataTable方便的多
      

  3.   

    使用
    Hashtable方便一点
    dim hash as new hashtable
    hash.add("键","值")用完之后
    hash.clear
      

  4.   

    这里有个和你差不多的问题
    http://community.csdn.net/Expert/topic/3562/3562339.xml?temp=.7205774
      

  5.   

    但我想通过checkbox进行选择删除,