如何使UpdatePanel内是否工作正常? [英] How to make TinyMCE work inside an UpdatePanel?

查看:175
本文介绍了如何使UpdatePanel内是否工作正常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试这样做,很多人似乎已经能够做到但我无法实施任何解​​决方案的东西。该 TinyMCE的控制工程$ P $在一个asp.net的形式ptty很好,直到你与一个UpdatePanel,请将其然后回发后休息。我已经尝试了一些修正,如RegisterClientScriptBlock方法,但我仍然不成功,我还是输回发后TinyMCE的控制。

I'm trying to do something that many people seem to have been able to do but which I am unable to implement any solution. The TinyMCE control works pretty well in an asp.net form until you enclose it with an UpdatePanel, which then breaks after postback. I have tried some fixes like the RegisterClientScriptBlock method, but am still unsuccessful, I still lose the tinyMCE control after postback.

以下是在每个具有的UpdatePanel和一个内外部的控制,以一个按钮生成回传一个完整的测试项目(VS 2008)。此外,在该项目我有其中包括一些评论呼吁我试过的code进行EditorTest控制的情况下,它给任何人任何想法。

Below is a full test project (VS 2008) provided with a Control outside UpdatePanel and one inside, with a button on each to generate postback. Also in the project I have a EditorTest control which include commented code of some calls I tried, in case it gives anyone any ideas.

code样品

下面是一些来源的MCE论坛的一些解决方案:结果
AJAX 结果
的UpdatePanel

Here are some sources for some solutions on the MCE forum :
AJAX
UpdatePanel

推荐答案

要执行的init 每次在的UpdatePanel 您需要使用注册脚本修改的ScriptManager

To execute the init everytime the UpdatePanel changes you need to register the script using ScriptManager:

// control is your UpdatePanel
ScriptManager.RegisterStartupScript(control, control.GetType(), control.UniqueID, "your_tinymce_initfunc();", true);

注意::你不能使用确切在你的初始化功能模式,您可以使用文本域类选择,否则将无法正常工作。

NOTE: You cannot use exact mode on your init function, you can use either textareas or a class selector, or else it won't work properly.

您也可以选择使用

ScriptManager.RegisterOnSubmitStatement(this, this.GetType(), "", "tinyMCE.triggerSave();");

在一个UpdatePanel的编辑内容没有保存在文本框的回传,因为默认行为是仅适用于 form.submit ,所以当你提交任何它将其上岗前保存文本。

On a postback of a UpdatePanel the editor content isn't saved on the Textbox, because the default behavior is only for form.submit, so when you submit anything it will save the text before it posts.

在code后面让你只需要访问值 TextBox.Text 属性。

On the code behind to get the value you will just need to access TextBox.Text property.

注意:如果您使用的是.NET GZip压缩的,你可能将不得不放弃它,我无法得到它的工作,我不得不完全消除这种

NOTE: If you are using the .NET GZipped you probably will have to drop it, I couldn't get it working, I had to remove this completely.

这篇关于如何使UpdatePanel内是否工作正常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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