Totals in grid footer?

Discussion in 'ASP .Net Datagrid Control' started by SStory, May 11, 2004.

  1. SStory

    SStory Guest

    Is there a way to show subtotals in the footer of a datagrid?

    How?

    Thanks,

    Shane
     
    SStory, May 11, 2004
    #1
    1. Advertising

  2. > Is there a way to show subtotals in the footer of a datagrid?
    >
    > How?


    Essentially you need to keep a running total, updating the running total
    in the ItemDataBound event handler for each Item or AlternatingItem.
    For the Footer, you need to programmatically insert this running total
    value.

    There's an article here that shows how to accomplish this and more:
    http://aspnet.4guysfromrolla.com/articles/073003-1.aspx

    Happy Programming!

    --

    Scott Mitchell

    http://www.4GuysFromRolla.com
    http://www.ASPFAQs.com
    http://www.ASPMessageboard.com

    * When you think ASP, think 4GuysFromRolla.com!
     
    Scott Mitchell [MVP], May 11, 2004
    #2
    1. Advertising

  3. SStory

    SoftLion Guest

    Or simply you can add a Table to your DataSet (it supports more than one
    table/=result set/=query returned all in only one database roundtrip !) with
    totals in it and modify the FooterItemTemplate of each item to display the
    content of this second table.
    This way you'll get the total correct even if pagination is turned on.

    4GuysFromRolla rocks, thanks to you for your excellent datagrid's articles !
    It's the best jump start I've found. Though you could improve the handling
    of drop-downs (static) content by using the same technique as above.
    What is missing is how to get a good user feeling when editing in a datagrid
    : simulate smartnavigation while editing (add/delete/modify) the grid
    content.

    Benjamin.

    "Scott Mitchell [MVP]" <> a écrit dans le message
    de news:vx8oc.7245$...
    > > Is there a way to show subtotals in the footer of a datagrid?
    > >
    > > How?

    >
    > Essentially you need to keep a running total, updating the running total
    > in the ItemDataBound event handler for each Item or AlternatingItem.
    > For the Footer, you need to programmatically insert this running total
    > value.
    >
    > There's an article here that shows how to accomplish this and more:
    > http://aspnet.4guysfromrolla.com/articles/073003-1.aspx
    >
    > Happy Programming!
    >
    > --
    >
    > Scott Mitchell
    >
    > http://www.4GuysFromRolla.com
    > http://www.ASPFAQs.com
    > http://www.ASPMessageboard.com
    >
    > * When you think ASP, think 4GuysFromRolla.com!
     
    SoftLion, May 12, 2004
    #3
  4. Saravana [MVP], May 14, 2004
    #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. Guest
    Replies:
    2
    Views:
    469
    Guest
    Jul 2, 2004
  2. mark

    footer totals

    mark, Sep 7, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    501
    Greg Burns
    Sep 7, 2004
  3. =?Utf-8?B?SnVzdGlu?=

    Showing datagrid totals in the footer

    =?Utf-8?B?SnVzdGlu?=, Oct 14, 2004, in forum: ASP .Net
    Replies:
    9
    Views:
    4,657
    =?Utf-8?B?SnVzdGlu?=
    Oct 15, 2004
  4. =?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:
    894
    Alexey Smirnov
    Feb 16, 2007
  5. RockNRoll

    NEWBIE - Column Totals in Footer of mxDataGrid

    RockNRoll, Aug 12, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    168
    Alvin Bruney [MVP]
    Aug 13, 2004
Loading...

Share This Page