Hi,
how do get pay of product (*) of rows and ...
sum columns from data grid view ... then show in textBox ?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Saber ShaikhPosted Apr 3, 2015, 12:17 AM
foreach (GridViewRow gr in GridView1.Rows)
{
Sum= Sum+ int.Parse(gr.Cells[1].ToString()));//columns [] inext
}
TextBox1.Text = Sum.ToString();
Blog : http://aspnettutorialscode.blogspot.in/
Syed ShanuPosted Apr 2, 2015, 10:47 PM
ghasem dehPosted Apr 2, 2015, 1:44 PM
Pankaj Kumar ChoudharyPosted Apr 2, 2015, 12:35 PM
protected void Button1_Click(object sender, EventArgs e)
{
int Sum=0;
foreach (GridViewRow gr in GridView1.Rows)
{
Sum+= int.Parse(gr.Cells[1].ToString()) * int.Parse(gr.Cells[2].ToString());
}
TextBox1.Text = Sum.ToString();
}