protected void DetailsView1_ItemCommand(object sender, DetailsViewCommandEventArgs e) { if (e.CommandName == "Select") { HttpCookie profDetailsCookie = new HttpCookie("ProfDetails"); DataView dview = (DataView)SDSCourseDetails.Select(DataSourceSelectArguments.Empty); string value = (String)dview.Table.Rows[0]["ProfName"]; profDetailsCookie["ProfName"] = (String)dview.Table.Rows[0]["ProfName"]; profDetailsCookie["Specalization"] = (String)dview.Table.Rows[0]["Specalization"]; profDetailsCookie["Location"] = (String)dview.Table.Rows[0]["Location"]; profDetailsCookie["CourseName"] = (String)dview.Table.Rows[0]["CourseName"]; profDetailsCookie["SchoolName"] = (String)dview.Table.Rows[0]["SchoolName"]; profDetailsCookie["Email"] = (String)dview.Table.Rows[0]["Email"]; profDetailsCookie["Expr1"] = (String)dview.Table.Rows[0]["Expr1"]; //details PDF URL if ((String)dview.Table.Rows[0]["ImgUrl"] != "NA") { profDetailsCookie["Image"] = (String)dview.Table.Rows[0]["ImgUrl"]; } else { // set default image to Prof if not avilable in databse. profDetailsCookie["Image"] = "http://sr.photos3.fotosearch.com/bthumb/CSP/CSP993/k14955079.jpg"; } Response.Cookies.Add(profDetailsCookie); Response.Redirect("ProfessorDetails.aspx"); } }
//Method to get the required course details private void getCourseDetails() { String courseID = Request.QueryString["courseID"]; CourseID.Text = courseID; DataView dview = (DataView)SDSCourseDetails.Select(DataSourceSelectArguments.Empty); CourseName.Text = (String)dview.Table.Rows[0]["CourseName"]; ProfessorName.Text = (String)dview.Table.Rows[0]["ProfName"]; ProfessorName.Text = (String)dview.Table.Rows[0]["ProfName"]; professorId = (String)dview.Table.Rows[0]["ProfID"]; }