protected void btnEnroll_Click(object sender, EventArgs e) { string course_id = Request.QueryString["CID"]; int student_id; int.TryParse((Request.QueryString["SID"]), out student_id); int cs = (from c in db.courses where c.id == course_id select Convert.ToInt32(c.enroll_type)).Single(); if (cs == 1) { fs.EnrollMe(student_id, course_id, true); Response.Redirect("coursepage.aspx?CID=" + course_id + "&SID=" + student_id); } else if (cs == 2) { fs.EnrollMe(student_id, course_id, false); Panel1.Visible = false; Panel2.Visible = true; } }