protected void gvCommunityPartnerStudentView_RowUpdating(object sender, GridViewUpdateEventArgs e) { //Get the new values GridViewRow row = gvCommunityPartnerStudentView.Rows[e.RowIndex]; RadioButton RadbtnToggle = (RadioButton )row.FindControl("ddlSignUpStatus"); Label lblOpportunityID = (Label)row.FindControl("lblOpportunityID"); Label lblStudentID = (Label)row.FindControl("lblStudentID"); Label lblCPPID = (Label)row.FindControl("lblCPPID"); Label lblCPID = (Label)row.FindControl("lblCPID"); SignUpFor signUpFor = new SignUpFor(); signUpFor.StudentID = Convert.ToInt32(lblStudentID.Text); signUpFor.OpportunityID = Convert.ToInt32(lblOpportunityID.Text); signUpFor.CPPID = Convert.ToInt32(lblCPPID.Text); signUpFor.UpdateSignUpFor(); //Reset the edit index. gvCommunityPartnerStudentView.EditIndex = -1; //Bind data to the GridView control. DataBind(); }
protected void EditSignUpStatus(object sender, EventArgs e) { //Get the button that raised this event Button lblSignUpStatus = (Button)sender; //Get the row that contains this button GridViewRow gvr = (GridViewRow)lblSignUpStatus.NamingContainer; Label lblOpportunityID = (Label)gvr.FindControl("lblOpportunityID"); Label lblStudentID = (Label)gvr.FindControl("lblStudentID"); Label lblProfessorID = (Label)gvr.FindControl("lblProfessorID"); Label lblSectionID = (Label)gvr.FindControl("lblSectionID"); Label lblCPPID = (Label)gvr.FindControl("lblCPPID"); Label lblCPID = (Label)gvr.FindControl("lblCPID"); Session["OpportunityID"] = lblOpportunityID.Text; Session["StudentID"] = lblStudentID.Text; Session["ProfessorID"] = lblProfessorID.Text; Session["CPPID"] = lblCPPID.Text; Session["CPID"] = lblCPID.Text; SignUpFor signUpFor = new SignUpFor(); if (lblSignUpStatus.Text.Equals("Pending", StringComparison.OrdinalIgnoreCase)) { lblSignUpStatus.Text = "Approved"; } else { lblSignUpStatus.Text = "Pending"; } signUpFor.SignUpStatus = lblSignUpStatus.Text; signUpFor.StudentID = Convert.ToInt32(lblStudentID.Text); signUpFor.OpportunityID = Convert.ToInt32(lblOpportunityID.Text); signUpFor.CPPID = Convert.ToInt32(lblCPPID.Text); signUpFor.UpdateSignUpFor(); }