protected void btnDelete_Click(object sender, EventArgs e) { try { string theID = txtID.Text; TestOne_SQLDataClass.DeleteEmployee(theID); txtMessage.Value = "Record Deleted."; TestOne_SQLDataClass.getAllEmployees(); int index = (int)Session["Test1_Index"] + 1; DisplayRow(index); Session["Test1_Index"] = index; } catch (Exception ex) { txtMessage.Value = "Employee Not Deleted: " + ex.Message; } }
protected void btnSave_Click(object sender, EventArgs e) { try { string theID = txtID.Text; string firstName = txtFirst.Text; string lastName = txtLast.Text; string hireDate = txtHireDate.Text; string pos = txtPosition.Text; TestOne_SQLDataClass.InsertEmployee(theID, firstName, lastName, hireDate, pos); txtMessage.Value = "New Record Saved."; TestOne_SQLDataClass.getAllEmployees(); } catch (Exception ex) { txtMessage.Value = "Employee Not Inserted: " + ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { TestOne_SQLDataClass.getAllEmployees(); EmployeeGrid.DataSource = TestOne_SQLDataClass.tblEmployee; EmployeeGrid.DataBind(); }