protected void UserCourseDetailsView_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Select") { int rowIndex = Convert.ToInt32(e.CommandArgument); GridViewRow row = UserCourseDetailsView.Rows[rowIndex]; UserBO ob = new UserBO(); ob.userid = Session["User"].ToString(); ob.coursecode = row.Cells[1].Text; ob.registered = "Y"; ob.courseopened = "N"; clsBLL obj = new clsBLL(); if (obj.isregisteredBLL(ob) == 0) { obj.onregistrationcourseBLL(ob); obj.activateStatusBLL(ob); } Session["CourseSelected"] = row.Cells[1].Text; Response.Redirect("UserSelectedCoursePage.aspx"); } }