try this
int total = 0;
protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
TextBox txtweight_fact = (TextBox)e.Row.FindControl("txtweight_fact");
total += Convert.ToInt32(txtweight_fact.Text.Trim());
}
if (e.Row.RowType == DataControlRowType.Footer)
{
TextBox txttotal = (TextBox)e.Row.FindControl("txttotal");
txttotal.Text = total.ToString();
}
}