HTML Markup
The following HTML Markup consists of:
TextBox – For capturing Text.
TextBox has been assigned with a TextMode property set to MultiLine.
Button – For setting TextBox content to the Label.
The Button has been assigned with an OnClick event handler.
Label – For displaying TextBox content.
<asp:TextBox ID="txtTinyMCE" runat="server" TextMode="MultiLine"></asp:TextBox>
<br />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="Submit" />
<hr />
<asp:Label ID="lblContent" runat="server"></asp:Label>
TinyMCE plugin implementation
Inside the HTML, the following
TinyMCE JS file is inherited.
1. tinymce.min.js
The
TinyMCE plugin has been applied to TextArea element.
Note: The ASP.Net Multiline TextBox is rendered as TextArea element in HTML, hence the
TinyMCE plugin has been applied to TextArea element.
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.0.20/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({ selector: 'textarea', width: 300 });
</script>
Displaying the TinyMCE Rich Text Content
C#
protected void Submit(object sender, EventArgs e)
{
lblContent.Text = txtTinyMCE.Text;
}
VB.Net
Protected Sub Submit(sender As Object, e As System.EventArgs)
lblContent.Text = txtTinyMCE.Text
End Sub
Possible Error
The following error occurs when you try to submit HTML content to server.
Solution
The solution to this problem is provided in the following article.
Screenshot
Browser Compatibility
* All browser logos displayed above are property of their respective owners.
Demo
Downloads