protected void lblEditReview_Click(object sender, EventArgs e) { for (int i = 0; i < gvReviews.Rows.Count; i++) //Input Validation to make sure one and only one checkbox is selected { CheckBox cb; cb = (CheckBox)gvReviews.Rows[i].FindControl("cbSelect"); if (cb.Checked) { amountchecked = amountchecked + 1; } } if (amountchecked < 1) { lblMessage.Text = "Please Select a restaurant to work with"; } if (amountchecked > 1) { lblMessage.Text = "Please Select only one restaurant to work with"; } else { for (int i = 0; i < gvReviews.Rows.Count; i++) //If all conditions are good pull the information from the one selected { CheckBox cb; cb = (CheckBox)gvReviews.Rows[i].FindControl("cbSelect"); if (!cb.Checked) { continue; } else { UserFunctions uf = new UserFunctions(); UserObject user; user = (UserObject)Session["User"]; string username = user.username; ShowEditFunctions(); lblRestaurantName.Text = gvReviews.Rows[i].Cells[1].Text; lblRestaurantAddress.Text = gvReviews.Rows[i].Cells[2].Text; priceratinginitial = Convert.ToInt32(gvReviews.Rows[i].Cells[3].Text); ddlPriceRating.SelectedValue = gvReviews.Rows[i].Cells[3].Text; qualityratinginitial = Convert.ToInt32(gvReviews.Rows[i].Cells[4].Text); ddlQualityRating.SelectedValue = gvReviews.Rows[i].Cells[4].Text; reviewcommentsinitial = gvReviews.Rows[i].Cells[5].Text; txtNewComments.Text = gvReviews.Rows[i].Cells[5].Text; int ReviewId = uf.GetReviewID(username, reviewcommentsinitial, priceratinginitial, qualityratinginitial); Session["ReviewID"] = ReviewId; } } } }