protected void btnDelete_Click(object sender, EventArgs e) { if (Session["BranchPKID"].ToString() != "" && long.TryParse(Session["BranchPKID"].ToString(), out _PKID)) { _PKID = long.Parse(Session["BranchPKID"].ToString()); _branch = new BranchClass(_PKID); _branch.deleteRecord(_PKID); Session["BranchPKID"] = ""; } fillGridView(); }