473,403 Members | 2,293 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,403 software developers and data experts.

Best Aopproach At Totalling DataGrids

Hi,

I have tables which are going to display working hours ( Timesheet ) I was
wondering the best way to total them. The grid is filled with data from a
query bound to a table. Does anyone have any "Best Practices" to offer as a
solution. I need to total both down and across.

Many thanks


Nov 29 '05 #1
5 991
Item templates + on Rowadded (or similar) event keep a count.
Use a var in the page class and set it to 0 on load.
Then in the event add each value.


"Mr Newbie" <he**@now.com> schreef in bericht
news:eD**************@TK2MSFTNGP09.phx.gbl...
Hi,

I have tables which are going to display working hours ( Timesheet ) I was
wondering the best way to total them. The grid is filled with data from a
query bound to a table. Does anyone have any "Best Practices" to offer as
a solution. I need to total both down and across.

Many thanks

Nov 29 '05 #2
I don't think there's a best practice in this situation, but there's
many ways to accomplish this. If the datasource is a datatable or a
collection then you could iterate through these before you bind. With
a datatable you could add a column dynamically and populate it with a
total going across. You could also add a row for the total line at the
bottom.

Another option would be to accumulate counters in the grid's
itemdatabound event, assuming that the grid always appears on a single
page.

Nov 29 '05 #3
Thanks for your help

--
Best Regards

The Inimitable Mr Newbie º¿º
"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dm**********@azure.qinip.net...
Item templates + on Rowadded (or similar) event keep a count.
Use a var in the page class and set it to 0 on load.
Then in the event add each value.


"Mr Newbie" <he**@now.com> schreef in bericht
news:eD**************@TK2MSFTNGP09.phx.gbl...
Hi,

I have tables which are going to display working hours ( Timesheet ) I
was wondering the best way to total them. The grid is filled with data
from a query bound to a table. Does anyone have any "Best Practices" to
offer as a solution. I need to total both down and across.

Many thanks


Nov 29 '05 #4
Hmm, prerender might be the best option.
Afaik it's based on current view/data.

<jh*****@yahoo.com> schreef in bericht
news:11**********************@f14g2000cwb.googlegr oups.com...
I don't think there's a best practice in this situation, but there's
many ways to accomplish this. If the datasource is a datatable or a
collection then you could iterate through these before you bind. With
a datatable you could add a column dynamically and populate it with a
total going across. You could also add a row for the total line at the
bottom.

Another option would be to accumulate counters in the grid's
itemdatabound event, assuming that the grid always appears on a single
page.

Nov 29 '05 #5
I was thinking...
A hidden label or else can hold any value you want.
maybe this is an idea?
using a <div> you can hide it, but even an invisible (property) might be
even better.
It's code is not generated but for asp.net the control remains present.

I think i just found out a way to use this for my own benefit.
I'm sure it's equal to manipulating the common viewstate but easier to do
imo.

"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> schreef in bericht
news:dm**********@azure.qinip.net...
Item templates + on Rowadded (or similar) event keep a count.
Use a var in the page class and set it to 0 on load.
Then in the event add each value.


"Mr Newbie" <he**@now.com> schreef in bericht
news:eD**************@TK2MSFTNGP09.phx.gbl...
Hi,

I have tables which are going to display working hours ( Timesheet ) I
was wondering the best way to total them. The grid is filled with data
from a query bound to a table. Does anyone have any "Best Practices" to
offer as a solution. I need to total both down and across.

Many thanks


Dec 4 '05 #6

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

Similar topics

2
by: John Smith | last post by:
Hey folks, I'm writing a Windows application which has many forms which have Datagrids on them to display data. These datagrids will not be editable in anyway. They are there to just view the...
1
by: Simon Harris | last post by:
Hi All, I wish to populate more than one datagrid from the same OleDBCommand. The code I have is: Dim objCmd As New OleDbCommand(strSql, objConn) Then... ...
4
by: ree32 | last post by:
I have a placeholder and depending on a user input(a drop downlist) when the user clicks a button I dynamically create a number of datagrids and fill them with data from a database. But the problem...
4
by: Dave | last post by:
(My apologies for posting this on two forums. I have just found out the other one was the incorrect location) I am writing a VB.NET 2003 web application to operate on my company's intranet. It...
2
by: Henrootje | last post by:
I have a report concerning a customer. In this report we find four subreports. They are in layout identical but data comes from different tabel. Now on the main report I count the totals of each...
0
by: ZRexRider | last post by:
Hi, I have a report driven by a SQL database. I have a populated recordset having a user name and a number of data/time fields. I process these time fields in the report's Detail_Print event. ...
7
by: Ausclad | last post by:
Ok, ill try again..... It seems fairly simple. I have two combo boxes in a datagrid. The datagrid is bound to a a table in a dataset. The two combo boxes are bound to a single data table...
2
by: rn5a | last post by:
In a shopping cart app, a ASPX page retrieves the order details & personal details of a user from a MS-Access database table depending upon the username of the user. The order details of a...
2
by: bassman | last post by:
In a simple grouping and totalling query, the values 153.98 and 91.65 appear in a field within a group of records and will be summed by the query. It doesn't take much to figure that the answer...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.