protected void grdStudent_RowCommand(object sender, GridViewCommandEventArgs e) { int StudentId = 0; int Index = Convert.ToInt32(e.CommandArgument); if (grdStudent.Rows[Index] != null) { GridViewRow Row = grdStudent.Rows[Index]; StudentId = Row.Cells[0].Text.ToInt(); hdfStudentId.Value = StudentId.ToString(); } if (e.CommandName == "RemoveRow") { RemoveStudent(StudentId); } if (e.CommandName == "EditRow") { mStudentBase = new clsSchool.StudentDB().GetById(StudentId); LoadForm(); } }
private void UnloadForm(int StudentId) { //if (string.IsNullOrEmpty(hdfPassword.Value)) //{ // hdfPassword.Value = txtPassword.Text; //} mStudentBase = new clsSchool.StudentBase(); mStudentBase.StudentId = StudentId; mStudentBase.FirstName = txtFirstName.Text; mStudentBase.LastName = txtLastName.Text; mStudentBase.StudentName = txtFirstName.Text + " " + txtLastName.Text; mStudentBase.Address1 = txtAddress1.Text; mStudentBase.Address2 = ""; mStudentBase.Suburb = TxtSuburb.Text; mStudentBase.City = TxtCity.Text; mStudentBase.Phone = txtPhone.Text; mStudentBase.Mobile = FormatMobile(txtMobile.Text); mStudentBase.Email = txtEmail.Text; mStudentBase.Password = ""; mStudentBase.Active = chkActive.Checked; }