protected void grdStaff_RowCommand(object sender, GridViewCommandEventArgs e) { int StaffId = 0; int Index = Convert.ToInt32(e.CommandArgument); if (grdStaff.Rows[Index] != null) { GridViewRow Row = grdStaff.Rows[Index]; StaffId = Row.Cells[0].Text.ToInt(); hdfStaffId.Value = StaffId.ToString(); } if (e.CommandName == "RemoveRow") { RemoveStaff(StaffId); } if (e.CommandName == "EditRow") { mStaffBase = new clsSchool.StaffDB().GetById(StaffId); LoadForm(); lblPassword.Visible = false; txtPassword.Visible = false; } }
private void UnloadForm(int StaffId) { if (string.IsNullOrEmpty(hdfPassword.Value)) { hdfPassword.Value = txtPassword.Text; } mStaffBase = new clsSchool.StaffBase(); mStaffBase.StaffId = StaffId; mStaffBase.FirstName = txtFirstName.Text; mStaffBase.LastName = txtLastName.Text; mStaffBase.Phone = txtPhone.Text; mStaffBase.Mobile = FormatMobile(txtMobile.Text); mStaffBase.Email = txtEmail.Text; mStaffBase.Password = hdfPassword.Value; mStaffBase.IsActive = chkActive.Checked; }