protected void LikeComment_Button_Click(object sender, CommandEventArgs e) { if (Session["UserInfo"] != null) { MessageInfo comment = new MessageInfo(); comment.MessageID = int.Parse(e.CommandArgument.ToString()); comment.UserID = user.UserID; comment.AddLike(); mynewcomment = user.GetNewComment(); AspNetPager.RecordCount = mynewcomment.Tables["NewComment"].Rows.Count; AllMyNewComment_DataList.DataSource = FilterTable(mynewcomment.Tables["NewComment"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1); AllMyNewComment_DataList.DataBind(); //Response.Redirect(Request.Url.AbsoluteUri); } }
protected void LikeComment_Button_Click(object sender, CommandEventArgs e) { if (Session["UserInfo"] != null) { MessageInfo comment = new MessageInfo(); comment.MessageID = int.Parse(e.CommandArgument.ToString()); comment.UserID = user.UserID; if (1 == comment.AddLike()) { AllDataBind(); } else { ScriptManager.RegisterStartupScript(Page, GetType(), "likefailed", "alert('你已赞过');", true); } } else { HttpContext.Current.Response.Write("<script type='text/javascript'>alert('闲置时间过长,请重新登录');location.href='" + Request.Url.AbsoluteUri + "'</script>"); } }