0
剛試圖在我的頁腳行中顯示我的總價格。 這裏是我的代碼來嘗試,但它似乎沒有通過它甚至將我在需要在gridview中顯示總價格
Sub gvPayments_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
' add the UnitPrice and QuantityTotal to the running total variables
invoiceTotal += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Total"))
ElseIf e.Row.RowType = DataControlRowType.Footer Then
e.Row.Cells(0).Text = "Total:"
' for the Footer, display the running totals
e.Row.Cells(5).Text = invoiceTotal.ToString("c")
e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right
e.Row.Font.Bold = True
End If
End Sub
如果您需要任何更多的我的代碼放在一個破發點,只問!
除非我記錯了頁腳沒有數據綁定 –
也許你應該試試這個在數據綁定 – deostroll
有你添加網格視圖的ShowFooter =「真正的」屬性? –