百度编辑器的使用,不会。。。。。

不会出现 用文本域时加载页面先显示带标签的数据,然后才加载出编辑器正常显示文本!

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="sbs4.aspx.cs" Inherits="sciencePraiseSystem.sbs.sbs4" ValidateRequest="false" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>编辑器</title>
    <link href="../css/css.css" rel="stylesheet" type="text/css" />
    <link href="../css/style.css" rel="stylesheet" type="text/css" />
    <link href="../css/tab.css" rel="stylesheet" type="text/css" />
    <meta http-equiv="Content-Type" content="text/html;charset=gbk" />
        <script type="text/javascript" src="/js/jquery-1.8.2.js"></script>
    <script type="text/javascript" charset="gbk" src="/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="gbk" src="/ueditor/ueditor.all.min.js"> </script>
    <script type="text/javascript" charset="gbk" src="/ueditor/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript">
        function validate() {

            if (editor.getContentLength() > 20000) {
                alert('文件大小超出最大值,请减小文件大小!');
                return false;
            }
            else {
                if (editor.getContentLength(true) > 1200) {
                    alert('字数超出1200个字符!');
                    return false;
                }
                else {
                    return true;
                }
            }
        }



    </script>
<style type="text/css">
<!--
.STYLE1 {
    font-size: 18px;
    font-family: "微软雅黑";
}
.STYLE2 {
    font-size: 14px;
    font-family: "微软雅黑";
}
-->
</style>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
            <asp:UpdatePanel ID="sbsUpdatePanel" runat="server">
                <ContentTemplate>
                        <table width="1000" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td height="40" align="center" class="STYLE3">
                                    <p align="center" class="STYLE1">四、第三方评价</p></td>
                            </tr>
                        </table>
                        <table width="1000" cellspacing="0" cellpadding="0">
                          <tr>
                            <td height="43" align="left" valign="middle"><span class="STYLE2" style="height: 30px; margin-top: 10px;">技术检测报告、鉴定结论、验收意见,或者同行科技工作者在学术刊物或公开场合发表的针对本项目主体核心内容的评价性意见(限一页)</span></td>
                          </tr>
                        </table>
                        <script id="container" name="content" type="text/plain" style=" 900px; height: 500px;"><%=sContent%></script>
                        <script type="text/javascript">
                            var editor;
                            $(document).ready(function () {
                                editor = UE.getEditor('container');
                                editor.setOpt({
                                    wordCount: true,
                                    maximumWords: 1200,
                                    wordCountMsg: editor.options.wordCountMsg || editor.getLang("wordCountMsg"),
                                    wordOverFlowMsg: editor.options.wordOverFlowMsg || editor.getLang("wordOverFlowMsg")
                                });
                            });
                        </script>
                        <div style=" 900px; text-align: center; height: 40px; margin-top: 10px;">
                            <asp:Button ID="btnSave" runat="server" Text="保存" OnClick="btnSave_Click" OnClientClick="return validate();" />
                        </div>
                </ContentTemplate>
                <Triggers>
                    <asp:PostBackTrigger  ControlID="btnSave"/>
                </Triggers>
            </asp:UpdatePanel>
        </div>
    </form>
</body>
</html>
aspx
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using sciencePraiseSystem.BLL;
namespace sciencePraiseSystem.sbs
{
    public partial class sbs4 : System.Web.UI.Page
    {
        public string sContent = "";
        private ExcuteSql excute = new ExcuteSql();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["person"] == null)
            {
                Response.Write("<script>window.parent.parent.location='/index.aspx'</script>");
            }
            else
            {
                if (!IsPostBack)
                {
                    if (Request["bh"] != null)
                        LoadWebMsg(Request["bh"].ToString());
                }
            }
        }
        private void LoadWebMsg(string bh)
        {
            string webcontent = excute.ReturnString("select webcontent from t_sbs_dsfpj where bh ='" + bh + "'");
            if (Request["opt"] != null && Request["opt"].ToString() == "ps")
            {
                string keywords = excute.ReturnString("select keywords from t_sbs_projectStatus where bh='" + bh + "'");
                if (!string.IsNullOrEmpty(keywords))
                {
                    webcontent = webcontent.Replace(keywords, "*********");
                }
                ViewState["opt"] = Request["opt"].ToString();
            }
            if (Session["person"].ToString() != excute.ReturnString("select writer from t_sbs_projectStatus where bh='" + bh + "'"))
            {
                btnSave.Visible = false;
            }
            else
            {
                //项目是否上报,没有上报可以修改,上报了只能查看
                string pstatus = excute.ReturnString("select pstatus from t_sbs_projectStatus where bh='" + bh + "'");
                if (!(pstatus.Equals("06") || pstatus.Equals("10")))
                {
                    btnSave.Visible = false;
                }
            }
            ViewState["bh"] = bh;
            if (webcontent != "nulltext")
            {
                sContent = webcontent;
                btnSave.Text = "更新";
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string webcontent = "";
            string sql = "";
            if (Request["content"] != null)
            {
                webcontent = Request["content"].ToString();
            }
            if (btnSave.Text == "保存")
            {
                sql = string.Format("insert into t_sbs_dsfpj values ('{0}',N'{1}')", ViewState["bh"].ToString(), webcontent);
            }
            else
            {
                sql = string.Format("update t_sbs_dsfpj set webcontent=N'{0}' where bh = '{1}'", webcontent, ViewState["bh"].ToString());
            }
            if (excute.ExecuteSql(sql) > 0)
            {
                string content = string.Format("<script type='text/javascript' language='language'>window.alert('申报书保存成功');window.parent.location='/sbs/sbsmain.aspx?bh={0}';</script>", ViewState["bh"].ToString());
                //ControlHelper.GetMsg(sbsUpdatePanel, this.GetType(), "申报书2保存成功");
                if (ViewState["opt"] != null && ViewState["opt"].ToString() == "ps")
                {
                    content = string.Format("<script type='text/javascript' language='language'>window.alert('申报书保存成功');window.parent.location='/sbs/sbsmain.aspx?bh={0}&opt=ps';</script>", ViewState["bh"].ToString());
                }
                ScriptManager.RegisterStartupScript(sbsUpdatePanel, this.GetType(), "open", content, false);
            }
            else
            {
                ControlHelper.GetMsg(sbsUpdatePanel, this.GetType(), "申报书保存不成功,请联系管理员");
            }
        }
    }
}
aspx.cs
原文地址:https://www.cnblogs.com/shadow-wolf/p/6845977.html