Solved

ASP.net GridView with totals at the bottom

Posted on 2016-10-28
2
50 Views
Last Modified: 2016-10-28
Hi

I know that this is probably not possible but is there any way to show the totals of all numeric columns in a bound GridView in ASP.net?

Thanks
0
Comment
Question by:murbro
2 Comments
 
LVL 51

Accepted Solution

by:
Ryan Chong earned 500 total points
ID: 41863494
yes, it's possible. you can do it in the RowDataBound event of your gridview and look for row type equals to footer, like:

protected void yourGridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Footer)
            {
                  e.Row.Cells[1].Text = "yourCalculated Total...";
             }
     }

Open in new window

further reading:

GridView Examples for ASP.NET 2.0: Displaying Summary Data in the Footer
https://msdn.microsoft.com/en-us/library/ms972833.aspx
1
 

Author Closing Comment

by:murbro
ID: 41863622
Thanks very much
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question