locked
how to use multiple tinymce on page in asp net? RRS feed

  • Question

  • User-1990983691 posted

    Hi all.

    My tinymce inside user control and I use 3 tinymce in one page. My tinymce inside update panel and i use mode: 'exact' for tinymce setting. I don't want to use mode: "textareas" for tinymce. When i run my project only 1 tinymce (OtherDescTBX) load and other tinymce does not show. What is my problem and How to solve this problem?

    Note:

    1- My tinymce inside user control.

    2- use ValidateRequest="false" for page.

    3- use <httpRuntime requestValidationMode="2.0" /> in web.config.

    4- use ScriptManager on masterpage.

    Thank you for help.

    My tinymcy code:

    <script runat="server">
            public TextBox SetSize { get { return txtContent; } }

            public HiddenField getHiddenField { get { return HiddenField1; } }
    </script>

    <script type="text/javascript" src="editors/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript">
       $(function () { LoadTinyMCE(); });
       var prm = Sys.WebForms.PageRequestManager.getInstance();
       prm.add_endRequest(function (sender, e) { LoadTinyMCE(); });
       function LoadTinyMCE() {
          tinyMCE.init({
             // General options 
             mode: "exact",
             elements: "<%=txtContent.ClientID %>",
             theme: "advanced",
             plugins: "autolink,lists,pagebreak,style,layer,table,save",
     
             // Theme options
             
             // Example content CSS (should be your site CSS)
             
            // Drop lists for link/image/media/template dialogs
            
           // Style formats
           
          // Replace values for the template plugin
          template_replace_values: {
               username: "Some User",
               staffid: "991234"
           },
           setup: function (ed) { ed.onChange.add(function (ed, l) { $('[id*=HiddenField1]').val(l.content); });
        }
       });
    }
    </script>

    <asp:TextBox runat="Server" ID="txtContent" CssClass="post" Width="100%" Height="550px" TextMode="MultiLine" />
    <asp:HiddenField ID="HiddenField1" runat="server" />

    My aspx page:

    <%@ Register Src="UserControls/tinymce.ascx" TagPrefix="Blog" TagName="TextEditor" %>

    <asp:UpdatePanel runat="server" ID="UpdatePanel2"><ContentTemplate>
    <table align="center">
    <tr>
    <td align="right"><asp:TextBox ID="ShortDescTBX" runat="server" CssClass="ManagerTBX" Width="350px" Height="60px" TextMode="MultiLine"></asp:TextBox></td>
    <td align="right"><asp:Label ID="Label3" runat="server" CssClass="ManagerLBL" Width="110px" Text="Short Desc :"></asp:Label></td>
    </tr>
    <tr>
    <td align="right" colspan="2"><Blog:TextEditor runat="server" id="CompleteDescTBX" /></td>
    <td align="right"><asp:Label ID="Label6" runat="server" CssClass="ManagerLBL" Width="110px" Text="Complete Desc :"></asp:Label></td>
    </tr>
    <tr>
    <td align="right" colspan="2"><Blog:TextEditor runat="server" id="TechnicalDescTBX" /></td>
    <td align="right"><asp:Label ID="Label9" runat="server" CssClass="ManagerLBL" Width="110px" Text="Technical Desc :"></asp:Label></td>
    </tr>
    <tr>
    <td align="right" colspan="2"><Blog:TextEditor runat="server" id="OtherDescTBX" /></td>
    <td align="right"><asp:Label ID="Label10" runat="server" CssClass="ManagerLBL" Width="110px" Text="Other Desc :"></asp:Label></td>
    </tr>
    </table>
    </ContentTemplate></asp:UpdatePanel>

    My aspx code page:

    if (((ScriptManager)this.Page.Master.FindControl("ScriptManager1")).IsInAsyncPostBack)
    {
            CompleteDescTBX.Text = Request.Form[CompleteDescTBX.getHiddenField.UniqueID];
            TechnicalDescTBX.Text = Request.Form[TechnicalDescTBX.getHiddenField.UniqueID];
            OtherDescTBX.Text = Request.Form[OtherDescTBX.getHiddenField.UniqueID];
    }

    Sunday, November 16, 2014 2:43 PM

Answers

All replies