Connecting Tech Pros Worldwide Forums | Help | Site Map

add new row to gridview with totals

Mike
Guest
 
Posts: n/a
#1: Feb 21 '08
On my gridview I need to a add a new row that will have totals of a previous
rows. It will be something like this


row1 1 2 3 4 9 10
11
row2 5 6 7 8 12 13
14
Total Row cell[1] + cell[6] | cell[2] + cell[7] | cell[3] + cell[8]
row4 15 16 17 18 19 20
21


and so one, Is this possible to accomplish and if so how would one do
something like this?



Eliyahu Goldin
Guest
 
Posts: n/a
#2: Feb 21 '08

re: add new row to gridview with totals


If you are with VS2008, use new ListView control that lets you use an item
template. Make an item template out of 2 rows, one for the cells and another
for the totals. In the ItemDataBound event calculate the totals and control
the total row visibility.

If you are with VS2005 or 2003, use a repeater.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"Mike" <Mike@aseagullpoopedonmyhead.comwrote in message
news:uDYza1IdIHA.3400@TK2MSFTNGP03.phx.gbl...
Quote:
On my gridview I need to a add a new row that will have totals of a
previous rows. It will be something like this
>
>
row1 1 2 3 4 9 10
11
row2 5 6 7 8 12 13
14
Total Row cell[1] + cell[6] | cell[2] + cell[7] | cell[3] +
cell[8]
row4 15 16 17 18 19 20
21
>
>
and so one, Is this possible to accomplish and if so how would one do
something like this?
>
>

Mike
Guest
 
Posts: n/a
#3: Feb 21 '08

re: add new row to gridview with totals


I'm using 2005 and I have the app completed. The users decided to show a
calculation field after the fact.
There is no way in the gridview to get the cell values, calculate them, then
add a new row with that total?


"Eliyahu Goldin" <REMOVEALLCAPITALSeEgGoldDinN@mMvVpPsS.orgwrote in
message news:%23V2oj9IdIHA.5448@TK2MSFTNGP03.phx.gbl...
Quote:
If you are with VS2008, use new ListView control that lets you use an item
template. Make an item template out of 2 rows, one for the cells and
another for the totals. In the ItemDataBound event calculate the totals
and control the total row visibility.
>
If you are with VS2005 or 2003, use a repeater.
>
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
>
>
"Mike" <Mike@aseagullpoopedonmyhead.comwrote in message
news:uDYza1IdIHA.3400@TK2MSFTNGP03.phx.gbl...
Quote:
>On my gridview I need to a add a new row that will have totals of a
>previous rows. It will be something like this
>>
>>
>row1 1 2 3 4 9 10
>11
>row2 5 6 7 8 12 13
>14
>Total Row cell[1] + cell[6] | cell[2] + cell[7] | cell[3] +
>cell[8]
>row4 15 16 17 18 19 20
>21
>>
>>
>and so one, Is this possible to accomplish and if so how would one do
>something like this?
>>
>>
>
>

Mark Rae [MVP]
Guest
 
Posts: n/a
#4: Feb 21 '08

re: add new row to gridview with totals


"Mike" <Mike@aseagullpoopedonmyhead.comwrote in message
news:ueaMq$IdIHA.484@TK2MSFTNGP06.phx.gbl...
Quote:
There is no way in the gridview to get the cell values, calculate them,
then add a new row with that total?
Fairly trivial:
http://www.google.co.uk/search?sourc...iew+totals+row


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Closed Thread