如何在页面加载ck编辑器加载asp.net中的文本时删除html代码 [英] How to remove html code at the time of page loads ck editor loading the text in asp.net

查看:130
本文介绍了如何在页面加载ck编辑器加载asp.net中的文本时删除html代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的wed应用程序,我有一个页面,它包含ck编辑器,当我加载该页面ck编辑器显示一些秒的HTML代码,它将显示在ck编辑器中的文本。我需要停止那个显示秒的部分HTML代码我怎么能这样做任何人都可以告诉我。

我的代码是:

  protected void Page_Load(object sender,EventArgs e)
{

if(!IsPostBack)
{
GetTemplate
}
}
public void GetTemplate()
{
ShowTemplate();
}
public void ShowTemplate()
{
// showTemplate代码
CKEditor1.Text = html;
}

谢谢。

 

code>< div style =height:400px; width:600px;>
< div style =display:noneid =CKPlaceHolder>
< asp:TextBox ID =CKEditorTextBoxrunat =serverTextMode =MultiLine>< / asp:TextBox&
< / div>
< / div>

我使用2 < div> 元素。一个实际上隐藏编辑器,第一个作为占位符,以防止在显示编辑器时跳过内容。



然后在JavaScript的某处:

  setTimeout(function(){document.getElementById('CKPlaceHolder')。style.display =block;},500); 


In my wed application, I have one page it contains ck editor when i load that page ck editor showing some fraction of seconds HTML code after it will display text in ck editor. I need to stop that showing fraction of seconds HTML code how can i do this can anyone tell me.
My code is:

protected void Page_Load(object sender, EventArgs e)
    {

      if (!IsPostBack)
      {
         GetTemplate();
       }      
    }  
    Public void GetTemplate()
    {
       ShowTemplate();
    }
    Public void ShowTemplate()
    {
      //showTemplate code
      CKEditor1.Text = html;
    }

Thank you.

解决方案

CKEditorYou can use a simple javascript trick to "hide" the CKEditor until it has been initialized.

<div style="height: 400px; width: 600px;">
    <div style="display: none" id="CKPlaceHolder">
        <asp:TextBox ID="CKEditorTextBox" runat="server" TextMode="MultiLine"></asp:TextBox>
    </div>
</div>

I use 2 <div> elements. One to actually hide the editor and the first one as a placeholder to prevent the jumping of the content once the editor will be shown.

And then somewhere in JavaScript:

setTimeout(function () { document.getElementById('CKPlaceHolder').style.display = "block"; }, 500);

这篇关于如何在页面加载ck编辑器加载asp.net中的文本时删除html代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆