如何在asp.net中发布时获取CKEDITOR的内容 [英] How to get contents of CKEDITOR when postingback in asp.net

查看:72
本文介绍了如何在asp.net中发布时获取CKEDITOR的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的ASP.NET项目中使用了CKEDITOR,该页面包含 asp:TextBox TextMode =Multiline和一个链接按钮。
当我按下linkbutton时,我无法在回发中获得TextBox值。
没有错误发生...
如何在服务器端获取内容?我正在考虑使用jQuery跟踪CK内容的变化并将其复制到隐藏的textarea ..但似乎不对。

I used CKEDITOR in my ASP.NET project, the page contains asp:TextBox with TextMode="Multiline" and a linkbutton. When I press linkbutton I can't get the TextBox value in postback.. No errors occured... How to get content in server side? I was thinking of use jQuery to track changes on content of CK and copy it to the hidden textarea..but didn't seem to be right.

我正在使用javascript版 CK v4.2 ,而不是.net库版。

I'm using javascript version of CK v4.2, not .net library version.

添加:

在使用CKEditor.zip文件下载的示例中,您可以看到使用$ _POST在服务器端获取文本很简单。

为什么在ASP.NET中没有?

Addition:
In the sample downloaded with CKEditor.zip file you can see that getting text in server side is easy using $_POST.
Why in ASP.NET isn't?

更新:

使用RadScriptManager,RadAjaxManager和RadAjaxPanel(来自telerik)时会出现此问题。

Update:
This issue occurs when using RadScriptManager, RadAjaxManager and RadAjaxPanel (from telerik).

推荐答案

在ASPX页面上将CKEditor控件设置为:

On the ASPX Page set the CKEditor control as:

<CKEditor:CKEditorControl ID="CKEditor1" runat="server"/>

在页面背后的代码中:

protected void Page_Load(object sender, EventArgs e)
{
    if (Page.IsPostBack)
    {
        string text1 = CKEditor1.Text;
        string text2 = CKEditor1.Value;
        ...
    }
}

请记住添加/包含对CKEditor二进制文件的正确引用

Remember to add/include proper references to CKEditor binaries

这篇关于如何在asp.net中发布时获取CKEDITOR的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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