public void LoadData() { try { int itemId = int.Parse(Session["itemId"].ToString()); lblAdviceId.Text = itemId.ToString(); BusinessLayer businessObj = new BusinessLayer(); ArrayList itemList = businessObj.LoadVoteData(itemId, connectionString); Items reqdItem = (Items)itemList[0]; ArrayList comments = (ArrayList)itemList[1]; txtQueryTitle.Text = reqdItem.ItemName; txtNoPositiveVotes.Text = reqdItem.PositiveVotes.ToString(); txtNoOfNegativeVote.Text = reqdItem.NegativeVotes.ToString(); RepComments.DataSource = comments; RepComments.DataBind(); //this.DataBind(); } catch { //Response.Redirect("ErrorPage.aspx"); } }
//绑定评论 protected void BindComments(int page) { int recordCount = 0; RepComments.DataSource = ProductService.CommentsService.Search(AspNetPagerComments.PageSize, page, new List <Expression>(), "AddDate desc", ref recordCount); RepComments.DataBind(); AspNetPagerComments.RecordCount = recordCount; }
protected void Page_Load(object sender, EventArgs e) { id = Convert.ToInt32(Request.QueryString["CMTBLOG"]); // var comm = db.TBLCOMMENT.Where(r => r.CMTBLOG == id).ToList(); var viewBlog = db.TBLBLOCG.Where(x => x.BLOGID == id).ToList(); RepBlog.DataSource = viewBlog; RepBlog.DataBind(); var comm1 = db.TBLCOMMENT.Where(r => r.CMTBLOG == id).ToList(); RepComments.DataSource = comm1; RepComments.DataBind(); }
private void RetrieveComments(int ActivityId) { IActivityService service = null; List <ActivityComment> ActivityCommentList = null; // Update. service = AppService.Create <IActivityService>(); service.AppManager = this.mAppManager; ActivityCommentList = service.RetrieveComments(ActivityId); if (ActivityCommentList != null) { RepComments.DataSource = ActivityCommentList; RepComments.DataBind(); } }
private void BindPosts() { ViewState["intBlogId"] = Convert.ToInt32(Request.QueryString["intBlogId"]); DataTable dtSub = new DataTable(); objblogdo.intAddedBy = Convert.ToInt32(ViewState["UserID"]); objblogdo.intBlogId = Convert.ToInt32(ViewState["intBlogId"]); dtSub = objblogda.GetDataTableComment(objblogdo, DA_NewBlogs.BlogCommnet.GetTop4ByBlog); if (dtSub.Rows.Count > 0) { RepComments.DataSource = dtSub; RepComments.DataBind(); } else { RepComments.DataSource = null; RepComments.DataBind(); } }
protected void BPostQuestion_Click(object sender, EventArgs e) { TextBox TBAnswer = (TextBox)LoginView1.FindControl("TBAnswer"); int ctitleId = Convert.ToInt32(Request.QueryString["forumId"]); string question = TBAnswer.Text; string posterName = HttpContext.Current.User.Identity.Name; DateTime dateTime = DateTime.Now; try { PostComment.insertComment(ctitleId, question, posterName, dateTime); LResult.Text = "Answer posted successfully."; TBAnswer.Text = ""; } catch (Exception ex) { LResult.Text = "Exception: " + ex.ToString(); } RepComments.DataBind(); }