protected void AddStudent_Click(object sender, EventArgs e) { int studentId = 0; int.TryParse(StudentIdHiddenField.Value, out studentId); DA.student student = new DataAccess.student(); student.fname = FnameBox.Text; student.Surname = SnameBox.Text; student.bcode = Int32.Parse(SemBox.Text); if (studentId > 0) { student.admno = studentId; DA.Manager.UpdateStudent(student); } else { DA.Manager.InsertStudent(student); } //After insert, redirect to update page Response.Redirect(String.Format("AddNewStudent.aspx?StudentId={0}", student.admno)); }
partial void Deletestudent(student instance);
partial void Updatestudent(student instance);
partial void Insertstudent(student instance);