try this.
protected void UpdateCustomer(object sender, GridViewUpdateEventArgs e)
{
cn.Open();
string sid = ((TextBox)GridView1.FooterRow.FindControl("txtsid")).Text;
string firstname = ((TextBox)GridView1.FooterRow.FindControl("txtfirstname")).Text;
string lastname = ((TextBox)GridView1.FooterRow.FindControl("txtlastname")).Text;
string gender = ((TextBox)GridView1.FooterRow.FindControl("txtgender")).Text;
string address = ((TextBox)GridView1.FooterRow.FindControl("txtaddress")).Text;
string phone = ((TextBox)GridView1.FooterRow.FindControl("txtphone")).Text;
string dob = ((TextBox)GridView1.FooterRow.FindControl("txtdob")).Text;
string email = ((TextBox)GridView1.FooterRow.FindControl("txtemail")).Text;
SqlCommand cmd = new SqlCommand();
cmd.Connection=cn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = " update student set firstname=@firstname,lastname=@lastname,gender=@gender,address=@address,photo=@phone,dob=@dob,email=@email where sid=@sid);" +
"select sid,firstname,lastname,gender,address,phone,dob,email from student";
cmd.Parameters.Add("@sid", SqlDbType.Int).Value = sid;
cmd.ExecuteNonQuery();
GridView1.DataBind();
cn.Close();
fillgrid();
}