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