1

Topic: Simple example of using TinyMCE on an ASP.NET 2.0 ".aspx" page

Does anybody have a simple example of how to use the TinyMCE editor on an ASP.NET 2.0 ".aspx" page? I just need a simple html edit control, take the users data and pass it along to another process int the web application. We originally used the TinyMCE editor in an older html/php based web app, but are now using ASP.NET for all new development. Thanks for any input.

2

Re: Simple example of using TinyMCE on an ASP.NET 2.0 ".aspx" page

I think just using a regular multiline Textbox should work:

        <asp:TextBox runat="server" ID="txtMyTextBox" Rows="10" TextMode="MultiLine"></asp:TextBox>

3

Re: Simple example of using TinyMCE on an ASP.NET 2.0 ".aspx" page

Please also note that if you are in which mode you are running: generally "textareas" or "exact"

if you don't want all the textbox fields using tinymce then use "exact" mode and then specific to tell which elements to use, e.g.

        mode : "exact",
        theme : "advanced",
        elements : "ctl00_ContentPlaceHolder1_MyTextBox", ....

Please note that the actual ID for that field is "MyTextBox" but after .net rendering, it will subsitute the contentplace holder name  in the front of the element, therefore, when specifying the elements, make sure you take that into consideration. 

Good Luck

4

Re: Simple example of using TinyMCE on an ASP.NET 2.0 ".aspx" page

mikebridge wrote:

I think just using a regular multiline Textbox should work:

        <asp:TextBox runat="server" ID="txtMyTextBox" Rows="10" TextMode="MultiLine"></asp:TextBox>

This works very well yes. It actually took me a very long time until I managed to get it completely work, there doesn't seem to be too much info about ASP and TinyMCE for newbies like me. (atleast not in documentation and on this forum)

Anyway. For ASP 2.0:

Put these in your .aspx file

<script language="javascript" type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
    mode : "textareas",
    theme : "advanced"
});
</script>

    <center>
        <asp:TextBox ID="MyTextBox" runat="server" Rows="10" TextMode="MultiLine" Width="557px" Height="267px"></asp:TextBox>
    </center>

After that you can simple use the MyTextBox textbox in your class file (.cs or .vb.. whatever) Your output can be found in MyTextBox.Text (if you added a submit button or use the save function of TinyMCE + PostBack)

I know it's easy as hell, but it took me over 2 hours to get this working. So I decided to take 10 minutes to post this, which might help people out in the future.

5

Re: Simple example of using TinyMCE on an ASP.NET 2.0 ".aspx" page

Thanks for that post, Kaas. 

Got me up and running with TinyMCE integrated into our custom CMS in about 10 minutes.  In the .cs file, all I did was set MyTextBox.text to the database content, and then did an update to the database requesting MyTextBox.text on postback.  Easy peezy.

6

Re: Simple example of using TinyMCE on an ASP.NET 2.0 ".aspx" page

tinyMCE is a very handy open source richtextbox, I found this (http://www.dottostring.com/2008/11/how- … t-website/) integration with asp.net 2.0 / 3.5 demostration quite helpful. hope it works for you.

7

Re: Simple example of using TinyMCE on an ASP.NET 2.0 ".aspx" page

I've found a newer post for integrating this editor with an asp.net website. There is example code here:http://webdeveloperpost.com/Articles/How-To-Use-TinyMCE-Editor-with-ASP-NET-Website.aspx

Last edited by ricketts (2011-06-10 14:17:49)

8

Re: Simple example of using TinyMCE on an ASP.NET 2.0 ".aspx" page

I wanted to also mention that there is an ASP.NET 4.0 server control that has this all built right into it:  http://www.msigman.com/2012/03/asp-net- … r-control/ complete with examples, source code, and documentation.