473,322 Members | 1,778 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,322 software developers and data experts.

Totals in footer (double up on sort)

Following Scott Mitchell's tutorial "Computing the Sum of a Column"
http://aspnet.4guysfromrolla.com/demos/dgExample28.aspx the value of
my summed columns are x2 (double up) upon first column sort command
(but remains at x2 on next column sorts)???

really strange!

Dim HR2_sum As Decimal = 0
Dim HR5_sum As Decimal = 0
Dim HR6_sum As Decimal = 0

Sub dg_ItemDataBound(ByVal sender As Object,
ByVal e As DataGridItemEventArgs)

If e.Item.ItemType = ListItemType.Item Or _
e.Item.ItemType = ListItemType.AlternatingItem Then

If Not IsDBNull(DataBinder.Eval(e.Item.DataItem, "HR2")) Then
Dim dHR2 As Decimal =
Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem, "HR2"))
HR2_sum += dHR2
End If
If Not IsDBNull(DataBinder.Eval(e.Item.DataItem, "HR5")) Then
Dim dHR5 As Decimal =
Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem, "HR5"))
HR5_sum += dHR5
End If
If Not IsDBNull(DataBinder.Eval(e.Item.DataItem, "HR6")) Then
Dim dHR6 As Decimal =
Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem, "HR6"))
HR6_sum += dHR6
End If

ElseIf e.Item.ItemType = ListItemType.Footer Then

e.Item.Cells(1).Text = "Totaler"
e.Item.Cells(2).Text = ""
e.Item.Cells(3).Text = ""
e.Item.Cells(4).Text = ""
e.Item.Cells(5).Text = ""
e.Item.Cells(6).Text = HR2_sum
e.Item.Cells(7).Text = HR5_sum
e.Item.Cells(8).Text = HR6_sum

End If

End Sub


Nov 18 '05 #1
0 1026

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

Similar topics

2
by: Steve | last post by:
Hi, I have xml data containing "line item" elements and a "footer" element which contains control totals for the line items. While I can easily validate the control totals in xslt, I have not...
2
by: Nothing | last post by:
I have a main report with several sub-reports on it. Some of the sub-reports are hidden some are visible. A few of the sub-reports hve totals calculated on them. I have a control in the sub-report...
2
by: | last post by:
I have gotten the following error in trying to get totals to come out on a footer. Server Error in '/test' Application....
3
by: mark | last post by:
im keeping running totals of certain columns in a datagrid, id like to put these totals in the footer - how do i do this ? or how can i put a label into the footer ? (im displaying results using...
4
by: Steve_s | last post by:
Hi I am having problems totalling a particular field in a subform.I am using Access 2003. The subform is based on a query which selects records with various financial information. I have 5 text...
3
by: igotyourdotnet | last post by:
I'm using a gridview and I have it formatted using sub headings. now I need to get totals for each sub heading. Is this possible? example: BMW (sub heading) 25,000 14,252 25,000 total:...
4
by: Micheal | last post by:
Greetings Access Group, Being relatively new to Access, I try to work through problems on my own and have been very successful, although I have a conundrum that I have been working on for two days...
0
by: Josetta | last post by:
Here is something really bizarre that is happening...let me see if I can describe it. I have a report which has two locations on it. Primary Location and Secondary Location. I have both...
1
by: csolomon | last post by:
Happy Friday! I was wondering if you can have more than one total in the footer. I ask this because when I set up one of my totals in the footer (lets call it total1), it works (slowly but it...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.