protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Current_screen_LB.Text = "Manage/Check Consent Forms"; //CreateFormBtn.Visible = true; //ManageFormBtn.Visible = false; classListDiv.Visible = false; FormInfoDiv.Visible = false; confirmationOverlay.Visible = false; foodprefcard.Visible = false; foodprefcardupdate.Visible = false; updateFormDiv.Visible = false; modalOverlay.Visible = false; FoodRadioButton.SelectedIndex = 0; CreateConsentFormDiv.Visible = false; DraftList.Visible = false; UserBO userbo = new UserBO(); ConsentFormBO consentformbo = new ConsentFormBO(); String currentLoggedInUser = Request.Cookies["CurrentLoggedInUser"].Value; List <String> TeachingClasses = userbo.getTeachersTeachingClasses(currentLoggedInUser); List <ConsentForm> consentFormRecordsDrafts = consentformbo.getDraftConsentFormsBySenderID(currentLoggedInUser); if (consentFormRecordsDrafts == null || consentFormRecordsDrafts.Count == 0) { DraftFormErrorMsg.Text = "There are no drafts created."; } DraftFormErrorMsg.Visible = false; List <ConsentForm> consentFormRecords = consentformbo.getConsentFormsBySenderID(currentLoggedInUser); if (consentFormRecords == null || consentFormRecords.Count == 0) { formErrorMsg.Text = "There are no forms created."; } else { consentFormRecords.Reverse(); //sorts by latest at the top } classesDropDownList.DataSource = TeachingClasses; classesDropDownList.DataBind(); string currentSchool = userbo.getUserById(Request.Cookies["CurrentLoggedInUser"].Value).school; classesDropDownList.SelectedIndex = 0; string selectedClass = classesDropDownList.SelectedValue; List <user> studentClassList = userbo.retrieveClassListBySchoolAndClass(currentSchool, selectedClass); classListGridView.DataSource = studentClassList; classListGridView.DataBind(); SelectedClassesListBox.DataSource = TeachingClasses; SelectedClassesListBox.DataBind(); //binds the data of classes that the user teaches updateSelectedClassesListBox.DataSource = TeachingClasses; updateSelectedClassesListBox.DataBind(); DraftList.DataSource = consentFormRecordsDrafts; DraftList.DataBind(); ConsentFormList.DataSource = consentFormRecords; ConsentFormList.DataBind(); //bind entries } }
protected void ConsentFormList_PageIndexChanging(object sender, GridViewPageEventArgs e) { ConsentFormBO consentformbo = new ConsentFormBO(); String currentLoggedInUser = Request.Cookies["CurrentLoggedInUser"].Value; List <ConsentForm> consentFormRecords = consentformbo.getConsentFormsBySenderID(currentLoggedInUser); consentFormRecords.Reverse(); ConsentFormList.DataSource = consentFormRecords; ConsentFormList.PageIndex = e.NewPageIndex; ConsentFormList.DataBind(); }