Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > add new row to gridview with totals

Reply
Thread Tools

add new row to gridview with totals

 
 
Mike
Guest
Posts: n/a
 
      02-21-2008
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?


 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      02-21-2008
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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?
>
>



 
Reply With Quote
 
 
 
 
Mike
Guest
Posts: n/a
 
      02-21-2008
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" <(E-Mail Removed)> wrote in
message news:%(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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?
>>
>>

>
>



 
Reply With Quote
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      02-21-2008
"Mike" <(E-Mail Removed)> wrote in message
news:ueaMq$(E-Mail Removed)...

> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running totals in gridview (when you have many totals required) =?Utf-8?B?Um9iZXJ0IENoYXBtYW4=?= ASP .Net 3 02-16-2007 12:03 PM
Advice sought. How do I add summary row (not databound) to gridview. Like weekly totals etc dave ASP .Net 1 02-14-2007 08:15 PM
GridView Totals Row as First Row Walt Zydhek ASP .Net Datagrid Control 1 01-17-2007 04:20 AM
add a new row with totals - gridview John ASP .Net Datagrid Control 5 06-13-2006 01:50 PM
ok I can do a totals row but how about a percentage row after each data row D ASP .Net Datagrid Control 0 05-23-2005 04:10 PM



Advertisments