protected void Page_Load(object sender, EventArgs e) { //Create a new Student, Suggestion object StudentClass objStudent = new StudentClass(); Suggestion objSuggestion = new Suggestion(); //Read Student, Suggestion from query string objStudent.studentId = Convert.ToInt32(Request.QueryString["StudentId"]); objSuggestion.studentId = Convert.ToInt32(Request.QueryString["StudentId"]); //Load Student, Suggestion information to controls int studenterrorCode = objStudent.getDetails(); int suggestionerrorCode = objSuggestion.getDetails(); if (studenterrorCode == 0) { lblProfileSugg.Text = objStudent.name; lblProfileSuggBar.Text = objStudent.name; } else if (studenterrorCode == -2) { lblProfileSugg.Text = "Unable to retrieve Student details for ID " + objStudent.studentId; lblProfileSugg.ForeColor = System.Drawing.Color.Red; } displaySuggestions(); Suggestion objAckSuggestion = new Suggestion(); objAckSuggestion.studentId = Convert.ToInt32(Request.QueryString["StudentId"]); objAckSuggestion.getDetails(); StudentClass objAckStudent = new StudentClass(); objAckStudent.studentId = Convert.ToInt32(Request.QueryString["StudentId"]); objAckStudent.getDetails(); bool suggestionstatus = true; //creating a variable to set the default status of the suggestion to be acknowledged for (int r = 1; r <= gvSuggestions.Rows.Count - 1; r++) { if (gvSuggestions.Rows[r].Cells[2].Text == "N") { suggestionstatus = false; } } if (objAckStudent.status == Convert.ToChar("N") && suggestionstatus == true) { btnApproveProfile.Visible = true; } else { btnApproveProfile.Visible = false; } }