开发者

How to sum the values in the datagrid view column

Hi i need is to sum the value of the colum开发者_如何学Gon 2nd the grand total must be done

CUSTOMERNAME    MONEY      DATE          

RAJA            1000      5/22/2011
RAM             15872     12/28/2010
RESHMA          12542     10/15/2010
POONAM          12345     2/25/2011
SANDEEP         54543     5/15/2011

                96,302 

where 96302 is the sum of the 2nd column

how to do this i need the coding can u plz help me............


Get the 2 tables return from the SQL Stored Procedure. In first one you can get the whole table, while in other you can get the sum of the column B.

Now attach the Sum of the column in Footer template using the Databound Event. You can easily bind this value in the footer template using this.

I assume that you are using the stored procedure for execution. If need more details specification please paste your code of databinding in datagrid.


Best to get the data from the database as a second query, but the other way is to code the ItemDataBound event. Useful if you are creating the data on the fly or doing some weird math.

You can find code samples here: http://www.codeproject.com/KB/aspnet/SumColumn.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜