主题: 字数限制
作者: 愤怒的狼, 发布日期: 2013-07-29 19:21:23, 浏览数: 2607
从数据库调出来的数据 有300-400字 不算html标签  一用editor.html()方法 或其他方法 就显示不出来 而且编辑器也没了 挺崩溃的  只能在 <textare><%=Info%></textarea>之间用脚本显示  求大神的解决方案  崩溃中
作者: 小f, 发布日期: 2013-07-30 10:34:02

看到你的贴 我顺手测了一下

500字也没问题啊  

你的用法肯定有问题

把代码贴出来 再说

回复
作者: 愤怒的狼, 发布日期: 2013-08-10 10:33:44

    <script>编辑器代码段
        var editor1;
        $(document).ready(function () {
            var options = {
                cssPath: 'kindeidtor/plugins/code/prettify.css',
                uploadJson: 'kindeidtor/asp.net/upload_json.ashx',
                fileManagerJson: 'kindeidtor/asp.net/file_manager_json.ashx',
                filterMode: false,
                allowUpload: true,
                allowFileManager: true,
                afterBlur: function () { this.sync(); },
                afterCreate: function () { this.sync(); }
            };
            editor1 = KindEditor.create('#editor_id', options);
            prettyPrint();
            var html = '<%=aa%>';
            editor1.html(html);
             //editor1.appendHtml('');
        });
    </script>

 

 

<form id="form1" runat="server">表单代码段
        <div>
            <textarea id="editor_id" name="content" style="width: 700px; height: 300px;">
               
            </textarea>
            <script type="text/javascript">
               
            </script>
        </div>
        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
    </form>

 

后台代码段

 public static string aa = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string sql = "select * from Content WHERE cONTENTiD = 501";
            aa = shujuku.GetDataSet(sql).Tables[0].Rows[0]["Info"].ToString();
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string a = Request.Form["content"];
        if (!string.IsNullOrEmpty(a))
        {
            string sql = "update Content SET Info='" + a + "' where contentId =501";
            shujuku.ExecuteSql(sql);
            sql = "select * from Content WHERE cONTENTiD = 501";
            aa = shujuku.GetDataSet(sql).Tables[0].Rows[0]["Info"].ToString();
        }
    }

 

 

大神给看看

回复
作者: 小浪子, 发布日期: 2013-08-12 13:21:01

回复愤怒的狼:一看你就是js与asp.net的初学者.

编辑又不是不能使用服务器控件方法

<script>编辑器代码段
        var editor1;
        $(document).ready(function () {
            var options = {
                cssPath: 'kindeidtor/plugins/code/prettify.css',
                uploadJson: 'kindeidtor/asp.net/upload_json.ashx',
                fileManagerJson: 'kindeidtor/asp.net/file_manager_json.ashx',
                filterMode: false,
                allowUpload: true,
                allowFileManager: true,
                afterBlur: function () { this.sync(); },
                afterCreate: function () { this.sync(); }
            };
            editor1 = KindEditor.create('#editor_id', options);
        });
    </script>
<form id="form1" runat="server">
  表单代码段
  <div>
<textarea id="editor_id" runat="server" style="width: 700px; height: 300px;"></textarea>
  </div>
  <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</form>
后台代码段 

 public static string aa = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string sql = "select * from Content WHERE cONTENTiD = 501";
            this.editor_id.Text = shujuku.GetDataSet(sql).Tables[0].Rows[0]["Info"].ToString();
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string a = this.editor_id.Text;
        string sql = "update Content SET Info='" + a + "' where contentId =501";
        shujuku.ExecuteSql(sql);
        strSql = "select * from Content WHERE cONTENTiD = 501";
        this.editor_id.Text = shujuku.GetDataSet(strSql).Tables[0].Rows[0]["Info"].ToString();
    } 

 

回复
发表新帖 发表回复