protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { txtComment.Attributes.Add("onblur", "this.className='CommentText';if(this.value == '') this.value = '" + "پیام" + "';"); txtName.Attributes.Add("onblur", "this.className='CommentText';if(this.value == '') this.value = '" + "نام" + "';"); txtEmail.Attributes.Add("onblur", "this.className='CommentText';if(this.value == '') this.value = '" + "نام خانوادگی" + "';"); } BOLComments CommentsBOL = new BOLComments(); rptComments.DataSource = CommentsBOL.GetCommentsByStatusCode(_itemCode, 2); rptComments.DataBind(); if (rptComments.Items.Count == 0) { rptComments.Visible = false; PublishInfo.Visible = false; } int PublishedCount = CommentsBOL.GetCommentByStatusCodeCount(_itemCode, 2); int WillNotBePublishedCount = CommentsBOL.GetCommentByStatusCodeCount(_itemCode, 3); lblPublishedCount.Text = "منتشر شده" + ": " + Tools.ChangeEnc(PublishedCount.ToString()); lblWillNotBePublishedCount.Text = "منتشر نشده" + ": " + Tools.ChangeEnc(WillNotBePublishedCount.ToString()); }
private void GetNewsComments() { string strNewsCode = Request.Form["NewsCode"]; int NewsCode; Int32.TryParse(strNewsCode, out NewsCode); if (NewsCode == 0) { return; } BOLComments CommentsBOL = new BOLComments(); var Result = CommentsBOL.GetCommentsByStatusCode(NewsCode, 2); JavaScriptSerializer serializer = new JavaScriptSerializer(); string json = serializer.Serialize((object)Result); Response.Write(json); Response.End(); }