How to make TinyMCE work inside an UpdatePanel?

前端 未结 12 929
别跟我提以往
别跟我提以往 2021-02-07 13:28

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 fo

12条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-07 13:50

    The correct way to make tinyMCE work in an updatepanel:

    1) Create a handler for the OnClientClick of your "submit" button.

    2) Run tinyMCE.execCommand("mceRemoveControl", false, '<%= txtMCE.ClientID %>'); in the handler, so as to remove the tinyMCE instance before the postback.

    3) In your async postback, use the ScriptManager.RegisterStartupScript to run tinyMCE.execCommand("mceAddControl", true, '<%= txtMCE.ClientID %>');

    Basically, all you need to do is use the mceRemoveControl command before the async postback and register a startup script to run the mceAddControl command after the async postback. Not too tough.

提交回复
热议问题