Nitol Biswas

Nitol Biswas

  • NA
  • 37
  • 1.5k

Can not sum GridView column with a variable

Dec 11 2016 1:52 AM
I want to sum GridView column value with a variable and show the result in second column.  I am trying to do this.But when I convert the GirdView column into an integer the following
 
"Input string was not in a correct format."  Error is occuring. 
 
Please help.
 
Here is my C# code:
 
for (int i = 0; i < GridView1.Rows.Count; i++)
{
long sum = openingBalace + Convert.ToInt64((GridView1.Rows[i].Cells[6].Text));
GridView1.Rows[i].Cells[8].Text = sum.ToString();
}
 
Thanks 

Answers (4)