You can try with below
On TextChanged Event Iterate through all GridViewRow and do summation of all txtmarks textbox value and final value should be assigned to txttotal.
double sum = 0;
foreach (GridViewRow item in GridView1.Rows)
var txt = item.FindControl("txtmarks") as TextBox;
sum += Convert.ToDouble(txt);
txttotal.Text = sum.ToString();
or you can use jQuery to get values from textbox and do summation using jQuery selectors.