add a second row to footer of gridview

N

NewTel

Using this code only gives me one new row. I need a second for some other
calculations. How?

Protected Sub grdExcel_RowDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs)

If e.Row.RowType = DataControlRowType.DataRow Then

' add the UnitPrice and QuantityTotal to the running total variables

SUM_AMOUNT2 += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, _

"AMOUNT"))

CANCEL_AMOUNT2 += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, _

"CANCEL_AMOUNT"))

Else

e.Row.Cells(3).Text = "Totals:"

' for the Footer, display the running totals

e.Row.Cells(4).Text = SUM_AMOUNT2.ToString("c")

e.Row.Cells(5).Text = CANCEL_AMOUNT2.ToString("c")

e.Row.Cells(6).Text = (SUM_AMOUNT2 - CANCEL_AMOUNT2).ToString("c")


e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right

e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right

e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right

e.Row.Font.Bold = True


End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top