/* * Pre: studentId must exist as a StudentId in the system * Post: The existing data for the student associated to the studentId * is loaded to the page. * @param studentId is the StudentId of the student being registered */ private Student loadStudentData(int studentId) { Student student = null; try { student = DbInterfaceStudent.LoadStudentData(studentId); //get eligible auditions if (student != null) { DataTable table = DbInterfaceStudentAudition.GetStateAuditionsForDropdownByYear(student, Convert.ToInt32(ddlYear.SelectedValue)); cboAudition.DataSource = null; cboAudition.Items.Clear(); cboAudition.DataSourceID = ""; //load student name txtFirstName.Text = student.firstName; txtLastName.Text = student.lastName; lblStudent.InnerText = student.firstName + " " + student.lastName; if (table.Rows.Count > 0) { cboAudition.DataSource = table; cboAudition.DataTextField = "DropDownInfo"; cboAudition.DataValueField = "AuditionId"; cboAudition.Items.Add(new ListItem("")); cboAudition.DataBind(); } else { lblAuditionError.InnerText = "The student has no eligible auditions"; lblAuditionError.Visible = true; } } else { lblErrorMsg.Text = "An error occurred while loading the student data."; lblErrorMsg.Visible = true; } } catch (Exception e) { lblErrorMsg.Text = "An error occurred while loading the student data."; lblErrorMsg.Visible = true; Utility.LogError("Badger Point Entry", "loadStudentData", "studentId: " + studentId, "Message: " + e.Message + " Stack Trace: " + e.StackTrace, -1); } return(student); }