Instated of using grid view row property retrive no of rows from the data set directly because row property changes with the paging
foreach (DataRow row in ds1.Tables[0].Rows)
{
totCal += Convert.ToDouble(row["salary"]);
}
lblsal.Text = " " + totCal;