[ASP ] Gridview 分頁 總計問題
不好意思又來請教各位~
目前在做gridview連結access資料庫時遇到的問題
程式碼如下:
Dim priceTotal3 As Decimal = 0
Dim quantityTotal3 As Decimal = 0
Protected Sub GridView13_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView13.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
priceTotal3 += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, _
"cost"))
quantityTotal3 += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, _
"num"))
ElseIf e.Row.RowType = DataControlRowType.Footer Then
e.Row.Cells(0).Text = "小計:"
e.Row.Cells(3).Text = quantityTotal3.ToString("d")
e.Row.Cells(4).Text = priceTotal3.ToString("c")
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right
e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right
e.Row.Font.Bold = True
End If
End Sub
這樣的寫法只能呈現出每個分頁的加總在footer上
請問要如何將分頁的小計作加總呢??
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.120.98.114
推
01/17 23:33, , 1F
01/17 23:33, 1F
→
01/18 14:59, , 2F
01/18 14:59, 2F
推
01/18 21:24, , 3F
01/18 21:24, 3F