protected void AddDropCourse_Button_Click(object sender, CommandEventArgs e) { if (Session["UserInfo"] != null) { CourseInfo course = new CourseInfo(); course.UserID = user.UserID; string[] arg = e.CommandArgument.ToString().Split(','); string courseid = arg[0]; string ischosen = arg[1]; course.CourseID = int.Parse(courseid); if (int.Parse(ischosen) == 0) { course.SelectCourse(); } if (int.Parse(ischosen) == 1) { course.DropCourse(); } allcourse = course.GetAllCourse(coursenum, coursename, teacher); AspNetPager.RecordCount = allcourse.Tables["AllCourse"].Rows.Count; CourseList_DataList.DataSource = FilterTable(allcourse.Tables["AllCourse"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1); CourseList_DataList.DataBind(); //Response.Redirect(Request.Url.AbsoluteUri); } else { HttpContext.Current.Response.Write("<script type='text/javascript'>alert('闲置时间过长,请重新登录');location.href='" + Request.Url.AbsoluteUri + "'</script>"); } }
protected void DropCourse_Button_Click(object sender, CommandEventArgs e) { CourseInfo course = new CourseInfo(); course.UserID = user.UserID; course.CourseID = int.Parse(e.CommandArgument.ToString()); course.DropCourse(); AllDataBind(); //Response.Redirect(Request.Url.AbsoluteUri); }