473,387 Members | 1,485 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

add a second row to footer of gridview

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
Feb 9 '06 #1
1 2031
The GridView is limited to a single Footer Row.

--

Andrew Robinson
http://blog.binaryocean.com
"NewTel" <dd**@dimdddabot.com> wrote in message
news:Da********************@comcast.com...
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

Feb 9 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: tfsmag | last post by:
I know how to do summary footers in a gridview... but when i try it in a paged gridview it puts a footer on every page of just the items on that page. Any suggestions on how to get it to work so...
1
by: Stu Lock | last post by:
Hi, I've spent the last hour trawling google for this - but all I find are people asking the same question! I have a gridview which is being databound to an empty datasource. I can display...
0
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I have a gridview. I calculated some values in the gridview for the footer of the gridview so basically I am adding all the values that are displayed in the gridview for each...
0
by: gnewsgroup | last post by:
Well, I am trying to use the footer row of a GridView for insertion purpose. There are some articles about this, for example, the gridviewguy.com has an example, which always displays the footer...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.