To display the total values in Grid view at footer
public int gettotal()
{
SqlConnection conn = new SqlConnection("connectionstring");
conn.Open();
SqlCommand cmd = new SqlCommand("SELECT SUM(salary) FROM emp", conn);
int totalsal = Convert.ToInt32(cmd.ExecuteScalar());
return totalsal;
}