Click here to Skip to main content
15,900,589 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have column name total_prize i have 10 records . I want to calculate prize of all products present in grid_view also it should print because I also want to get print into pdf for this the record should present into grid_view
For Purpose of printing I can't use external textbox/label to get addition into it.
Posted

1 solution

C#
int sum=0;
foreach (GridViewRow row in nameofthegrid.Rows)
{
 Label sum = (Label)row.FindControl(" column label id in item template to be add");
sum=sum+int.Parse(sum.Text);
TextBox1.Text=sum;
}

http://www.c-sharpcorner.com/UploadFile/rohatash/adding-values-in-column-and-sum-of-the-column-values-in-grid/[^]
To show the Sum of Total(Column Value) in Gridview Footer[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900