protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { int row = Table1.Rows.Count; string name = ""; bool flag = false; for (int i = 1; i < row; i++) { RadioButton check = new RadioButton(); check = (RadioButton)Table1.Rows[i].Cells[3].Controls[0]; if (check.Checked) { name = Table1.Rows[i].Cells[1].Text; flag = true; continue; } } if (!flag) { Label2.Visible = true; return; } Employee_pros pros = new Employee_pros(); int formId = pros.getFormId(name, Session["user"].ToString().TrimEnd()); Session["fid"] = formId.ToString(); Response.Redirect("EditForm.aspx"); }