how to calculate row-wise sum of values in grid-view and display it in grid view?
<p>I have a grid view which displays some values. now i have to calculate row wise sum of those values for each row and then display against them.</p>

<p><strong>i tried this code but i am getting error as Input String Was not in Correct Format.</strong></p>

<pre><code>public void gv_RowCreated(Object sender, GridViewRowEventArgs e)
{

    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        int total = Convert.ToInt32(e.Row.Cells[1].Text) + Convert.ToInt32(e.Row.Cells[2].Text) + Convert.ToInt32(e.Row.Cells[3].Text) + Convert.ToInt32(e.Row.Cells[4].Text) + Convert.ToInt32(e.Row.Cells[5].Text) + Convert.ToInt32(e.Row.Cells[6].Text) + Convert.ToInt32(e.Row.Cells[7].Text);

        ((Label)gv.FindControl("Label8")).Text = Convert.ToString(total);

    }
}
</code></pre>
