add new row to gridview with totals

Discussion in 'ASP .Net' started by Mike, Feb 21, 2008.

  1. Mike

    Mike Guest

    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, Feb 21, 2008
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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, Feb 21, 2008
    #2
    1. Advertising

  3. Mike

    Mike Guest

    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" <> wrote in
    message news:%...
    > 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" <> wrote in message
    > news:...
    >> 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, Feb 21, 2008
    #3
  4. Mark Rae [MVP], Feb 21, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dave
    Replies:
    1
    Views:
    600
    Bruno Alexandre
    Feb 14, 2007
  2. =?Utf-8?B?Um9iZXJ0IENoYXBtYW4=?=

    Running totals in gridview (when you have many totals required)

    =?Utf-8?B?Um9iZXJ0IENoYXBtYW4=?=, Feb 15, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    849
    Alexey Smirnov
    Feb 16, 2007
  3. D
    Replies:
    0
    Views:
    198
  4. John

    add a new row with totals - gridview

    John, Jun 9, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    5
    Views:
    327
    Bruno Alexandre
    Jun 13, 2006
  5. Walt Zydhek

    GridView Totals Row as First Row

    Walt Zydhek, Jan 15, 2007, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    892
    Alvin Bruney [MVP]
    Jan 17, 2007
Loading...

Share This Page