Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 410785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:55:21+00:00 2026-05-12T17:55:21+00:00

In ASP.NET 3.5 I have a datagrid that is bound to a somwehat dynamic

  • 0

In ASP.NET 3.5 I have a datagrid that is bound to a somwehat dynamic datatable. The datatable is created by taking three different tables returned from a dataset and combining them to create one table.

It goes like this. The first datatable returns a list of the columns that will be in the final datatable. The second datatable returns a list of people, their id number, status info and a grand total that is listed at the end of the row in the final table. The third table returns a list of values for a given type that matches the person id and the column from the first.

Example

Table1

ProdID    ProdName

1             Widgets

2             Stuff

…            …

Table 2

PersonID    PersonName

103             John Smith

105             Tim Doe

…                 …

Table 3

PersonID    ProdID    Amount

103             1             205.00

103             2             234.00

105             1             150.00

105             2             189.00

The Resulting Table becomes

PersonName    ProdName    Amount

John Smith       Widgets        205.00

John Smith       Stuff             234.00

Tim Doe           Widgets        150.00

Tim Doe           Stuff             189.00

I was able to write a Dictionary that sums each column by name, but I want to show the sum in the footer of the datagrid the end table is bound to.

So, the sum below Widgets should be 355 and the sum below Stuff should be 423. The problem is, I can’t figure out how to put these values in the footer. I tried OnDataBinding for the grid, but since the footer isn’t bound, then it never stops there. I don’t know if i can “rollup” the created table.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T17:55:21+00:00Added an answer on May 12, 2026 at 5:55 pm

    Something like this in the code-behind will work. You’ll need to change the cell indexes, DataTable name, etc, but this is essentially how you add a sum in the footer.

    GridView1.FooterRow.Cells[4].Text = string.Format("{0:C}", myDataTable.Compute( "sum(Net_Price)", ""));
    

    You also have to set the DataGrid’s “ShowFooter” property to “True”.

    Full article here:
    http://programming.top54u.com/post/ASP-Net-DataTable-Compute-Column-Sum-using-C-sharp.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ASP.NET 1.1 - I have a DataGrid on an ASPX page that is databound
I have a fairly big asp.net website that use GridView bound to the same
i working on asp.net & C# i have datagrid that contain my database. i
I have an ASP.NET Datagrid with several text boxes and drop down boxes inside
I have a DataGrid in ASP.NET 2.0 with the following column in it: <ASP:TEMPLATECOLUMN>
I have asp.net checkboxlist control that bounded to a data source so the number
I have an ASP.NET project that uses XML Serialization for the main operation for
I have a large dataset and datagrid on my asp.net page. I am going
So I have a ASP.NET DataGrid and in the SomeName_ItemBound I am trying to
ASP.NET apps that I've developed (on ASP.NET 2.0) have typically been backed by a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.