Sum a Datagrid row?

C

ClevelandSteve

Hello all,

I have a datagrid that returns sales of items by month from an Oracle
table using a datareader like so:

Item |Jan |Feb | ... |Dec
itm1 |10 |5 | ... |6
itm2 |7 |2 | ... |8

I want to add a column to the end of the datagrid that would sum the
row:
Item |Jan |Feb | ... |Dec |Total
itm1 |10 |5 | ... |6 |21
itm2 |7 |2 | ... |8 |17

I would think that this would be easy to do, but I can only find
articles that explain how sum a column into a footer. Could someone
point me in the right direction? I've only been programming in
asp.net for about four months now, so the help is appreciated.
 
C

Cowboy \(Gregory A. Beamer\)

Use the binding event of the Grid view (or DataGrid in .NET 1.1) and sum the
columsn there. Go ahead and explicitly add this column to the DataSet in the
designer (and the rest of the columns if you are wise). In the binding event
grab the current binding row and then access the columns in question.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside the box!
*************************************************
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top