ASP.net with tinymce editor - ReferenceError: tinyMCE is not defined
In the context of ASP.net C# tinyMCE can be bind to server side text areas .However you have to use suitable request validation method considering the security level expected
<asp:TextBox ID="textArea" ClientIDMode="Static" name="elm1" class="elm1" runat="server"
TextMode = "MultiLine" TabIndex="4" ></asp:TextBox>
In that context you can use class name of the text are and bind editor for all the text areas within same page using following parameters.Mode define the specific text areas to be selected and editor selctor select them from the class name.
eg:
<asp:TextBox ID="textArea_1" ClientIDMode="Static" runat="server"
TextMode = "MultiLine" TabIndex="4" ></asp:TextBox>
tinyMCE has to initiate with the mode of exact and the client ID has to be given.
<script type="text/javascript">
tinyMCE.init({
mode: "exact",
elements: "<%=textArea_1.ClientID %>",
So it enable to get the content in the client side script like below
function copyText() {
var content = tinymce.get('<%=textArea.ClientID %>').getContent({ format: 'raw', no_events: 1 });
document.getElementById('<%=Panel1.ClientID %>').innerHTML = content;
}
<asp:TextBox ID="textArea" ClientIDMode="Static" name="elm1" class="elm1" runat="server"
TextMode = "MultiLine" TabIndex="4" ></asp:TextBox>
In that context you can use class name of the text are and bind editor for all the text areas within same page using following parameters.Mode define the specific text areas to be selected and editor selctor select them from the class name.
<
script
type
=
"text/javascript"
>
tinyMCE.init({
mode: "specific_textareas",
editor_selector: "
elm1",
However if you want to use
tinyMCE for specific text ares as well as doing some client side functions in jQuery or JavaScript you have to use ID of the text Area.IT will avoid rising the error " ReferenceError: tinyMCE is not defined ".eg:
<asp:TextBox ID="textArea_1" ClientIDMode="Static" runat="server"
TextMode = "MultiLine" TabIndex="4" ></asp:TextBox>
tinyMCE has to initiate with the mode of exact and the client ID has to be given.
<script type="text/javascript">
tinyMCE.init({
mode: "exact",
elements: "<%=textArea_1.ClientID %>",
So it enable to get the content in the client side script like below
function copyText() {
var content = tinymce.get('<%=textArea.ClientID %>').getContent({ format: 'raw', no_events: 1 });
document.getElementById('<%=Panel1.ClientID %>').innerHTML = content;
}
Comments
Post a Comment