DVBBS ASP.NET论坛官方 注册  |   登录  |   搜索  |  帮助
DVBBS ASP.NET论坛官方  →  技术交流区  →  .Net技术讨论  →  关于购物车删除记录的问题,看看谁能解决?谢谢。
共有 198 人关注过本帖
上一主题 | 下一主题  

关于购物车删除记录的问题,看看谁能解决?谢谢。

我不在线哦! jmxhy7489 积分:12 等级:新手上路 文章:1 积分:12 注册:2008年5月10日 威望:1 点   楼主 个性首页 QQ 邮箱 主页 发短信 加为好友

我的问题,看看谁能解决?谢谢。
如图购物车,当按删除键时,一次删除了2记录,是什么原因?
代码如下:
GridView1_RowDeleting事件代码:
Dim order As orderinfo = CType(Session("order"), orderinfo)
        order.orderItemList.RemoveAt(e.RowIndex)
        If (order.orderItemList.Count = 0) Then
            order = Nothing
        Else
            Dim row As GridViewRow = GridView1.Rows(e.RowIndex)
            Dim num As Label = CType(row.FindControl("booksum"), Label)
            Dim n As Integer = Integer.Parse(num.Text)
            order.TotalNum = (order.TotalNum - n)
            Dim price As Label = CType(row.FindControl("bookprice"), Label)
            Dim p As Decimal = Decimal.Parse(price.Text)
            If (order.sumPrice <> 0) Then
                order.sumPrice = (order.sumPrice - p)
            Else
                Panel1.Visible = False
                Label5.Visible = True
            End If
        End If
        'Try
        If Not (order Is Nothing) Then
            Session("order") = order
        End If       
        showShop()
 End Sub

 Private Sub showShop()
        If Not (Session("order") Is Nothing) Then
            Panel1.Visible = True
            Label5.Visible = False
            Dim order As orderinfo = CType(Session("order"), orderinfo)
            GridView1.DataSource = order.orderItemList
            GridView1.DataBind()
            Label2.Text = order.TotalNum.ToString()
            Label4.Text = order.sumPrice.ToString()
        Else
            Panel1.Visible = False
            Label5.Visible = True
        End If
    End Sub
当按gridview控件中的删除按钮时,一次删除了2条记录,如何解决?谢谢。

2008-5-10 17:34:04   举报   Top
1  1 | 10    1/1 页