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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Saber ShaikhRank #1,686 · 905 reputationPosted Apr 2, 2015, 8:17 PM EDT
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/
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted Apr 2, 2015, 8:35 AM EDT
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();
}
Syed ShanuRank #87 · 23.7K reputationPosted Apr 2, 2015, 6:47 PM EDT
ghasem dehRank #8,160 · 227 reputationPosted Apr 2, 2015, 9:44 AM EDT