protected void Page_Load(object sender, EventArgs e) { if (Session["EmployeePKID"].ToString() != "" && long.TryParse(Session["EmployeePKID"].ToString(), out _PKID)) { _PKID = long.Parse(Session["EmployeePKID"].ToString()); _employee = new EmployeeClass(_PKID); if (!Page.IsPostBack) { displayRecord(); } } else { _employee = new EmployeeClass(); } }
protected void btnDelete_Click(object sender, EventArgs e) { if (Session["EmployeePKID"].ToString() != "" && long.TryParse(Session["EmployeePKID"].ToString(), out _PKID)) { _PKID = long.Parse(Session["EmployeePKID"].ToString()); _employee = new EmployeeClass(_PKID); _employee.deleteRecord(_PKID); Session["EmployeePKID"] = ""; } fillGridView(); }