private void AllDataBind() { course.CourseID = int.Parse(courseid); course.UserID = user.UserID; course.GetCourseInfo(); Teacher_TA = course.GetCourseTeacher(); mycomment = course.GetMyCourseComment(); Modify_Intro.Text = course.Introduction; T_DataList.DataSource = course.GetCourseTeacher().Tables["TeacherName"]; T_DataList.DataBind(); A_DataList.DataSource = course.GetCourseTeacher().Tables["AssistantName"]; A_DataList.DataBind(); if (user.isStudent == 1 && course.IsCourseTeacher() == 0) { if (mycomment.Tables["CourseComment"].Rows.Count != 0) { ModifyMyComment_TextBox.Text = mycomment.Tables["CourseComment"].Rows[0]["Content"].ToString(); Byte[] tags = new Byte[20]; Byte a = 1, b = 0; for (int i = 1; i <= 6; i++) { if (((Byte[])mycomment.Tables["CourseComment"].Rows[0]["Tags"])[i - 1] == a) { ((CheckBox)FindControl("MyCommentTagModify" + i.ToString() + "_CheckBox")).Checked = true; } else { ((CheckBox)FindControl("MyCommentTagModify" + i.ToString() + "_CheckBox")).Checked = false; } } } } MessageInfo mc = new MessageInfo(); if (mycomment.Tables["CourseComment"].Rows.Count != 0) { mc.MessageID = int.Parse(mycomment.Tables["CourseComment"].Rows[0]["CommentID"].ToString()); DataSet mycommentreply = mc.GetCommentReply(); MyCommentReplyComment_DataList.DataSource = mycommentreply; MyCommentReplyComment_DataList.DataBind(); MyReplyNum_div.InnerHtml = mycommentreply.Tables["Reply"].Rows.Count.ToString(); } allcomment = course.GetCourseComment(); AspNetPager.RecordCount = allcomment.Tables["CourseComment"].Rows.Count; AllComment_DataList.DataSource = FilterTable(allcomment.Tables["CourseComment"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1); AllComment_DataList.DataBind(); }
protected void AllMyNewCommentReply_DataList_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { MessageInfo comment = new MessageInfo(); comment.MessageID = int.Parse(DataBinder.Eval(e.Item.DataItem, "CommentID").ToString()); DataList dataList = e.Item.FindControl("ReplyComment_DataList") as DataList; DataSet commentreply = comment.GetCommentReply(); dataList.DataSource = commentreply; dataList.DataBind(); ((HtmlGenericControl)e.Item.FindControl("ReplyNum_div")).InnerHtml = commentreply.Tables["Reply"].Rows.Count.ToString(); } }