本帖最后由 prame001 于 2010-09-27 19:10:54 编辑

解决方案 »

  1.   

    好多if,不懂,看上面的解释,感觉用不到那么多if啊。
      

  2.   

                            if (bookcart.Contains (GridView1.Rows[i].Cells[1].Text))
                            {
                                Label3.Text += "the Book" + GridView1.Rows[i].Cells[1].Text + "exsits in shopping cart";
                                
                            }
                            else
                            {
                                booklist.Add(GridView1.Rows[i].Cells[1].Text);
                            }
    设置断点,单步
      

  3.   

    到session中做check不可取,一旦session过期,肯定出问题。
      

  4.   

            if (((CheckBox)GridView1.Rows[i].Cells[0].Controls[1]).Checked)//第9行
    if (bookcart.Contains (GridView1.Rows[i].Cells[1].Text))//第14行
    Cells[0]//第9行
    Cells[1]//第14行
    不一样是不是会有影响
      

  5.   

    Label3.Text = "the Book" + booklist.Add(GridView1.Rows[i].Cells[1].Text) + "exsits in shopping cart";
    我很不理解这句的含义 booklist.Add()返回什么?你也加上去?既然加了。。那你的IF就没意义了因为ELSE也是这句代码
    else
      {
      booklist.Add(GridView1.Rows[i].Cells[1].Text);
      }