postedit.cs

来自「ASP.NET简洁论坛源代码 这是一个简单的论坛」· CS 代码 · 共 44 行

CS
44
字号
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NetFocus.Web.Core;

namespace NetFocus.Web.Applications.Forum
{
    public class PostEdit : UserControl
    {
        protected ValuedEditor bodyEditor;
        protected ResourceButton saveButton;

        protected override void OnLoad(EventArgs e)
        {
            if (!Page.IsPostBack && !AjaxManager.IsCallBack)
            {
                BindData();
            }
            saveButton.Click += new EventHandler(SaveArticleComment);
        }

        private void BindData()
        {
            Post post = BusinessManager.GetPost(RequestBuilder.BuildPostRequest(WebContext.Current.EntityId));
            bodyEditor.Value = post.Body;
        }
        private void SaveArticleComment(object sender, EventArgs e)
        {
            Post post = BusinessManager.GetPost(RequestBuilder.BuildPostRequest(WebContext.Current.EntityId));

            post.Body = bodyEditor.Value;

            BusinessManager.UpdatePost(post);

            Page.Response.Redirect(SiteUrls.Instance().GetPostListUrl(post.ParentId));

        }

    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?