Search Wiki:

RTE (Rich Text Editor ASP.NET Control)


The key feature of the RTE is to support WYSIWYG along with the following generic feature set below. The key goal has been to encapsulate all the complex functionality of web based rich text editing into a single control.

All that you need is to drop the control dll into your bin directory, and include a single tag like <cc1:RichTextEditor ID="Rte1" Theme="Blue" runat="server" /> to get the full rich text editor working on your page!. You can use the Culture attribute to set it for use with other supported languages listed below.

Download: If you're wanting to download the latest stable bits, use the "Releases" tab, and if you want to get the latest source code bits, check out the "Source Code" tab.

Supported Browsers: Internet Explorer and FireFox
Live demo: See this Rich Text Editor in action at the live demo site!
Supported Styles / Formats: Bold, Italic, Underline, Justify, indentations, Plain Lists, Numbered Lists
Supported Commands: Copy, Paste, Cut, Add Hyperlink, Set Foreground Color, Set Highlight Color, Set Fonts, Set Font Sizes, Insert Smiles
Supported Views: Text View, Html View
Localization: Supported Languages include en-us, cs-cz, es-es, de-de, fr-fr, it-it, ja-jp, ko-kr, pt-br, ru-ru, zh-cn, zh-hk, zh-tw

Rte.png
Last edited Jun 6 at 8:45 PM  by yorkrj, version 21
Comments
gholbrook wrote  Nov 13 2007 at 7:15 PM  
line 84 tabstrip.css
background-image: url('<%= WebResource("AjaxControls.images.activetab-right-bg.gif")%>');

And the "CodeBehind" in the SampleWebSite on Default.aspx and Showtext.aspx should be "CodeFile".

SandpointGuy wrote  Nov 14 2007 at 3:15 PM  
Is the html generated by this control documented? Ive used a couple of other rich text controls in the past, and have been stung by the html (incomplete tables a biggie) that winds up in the database. Users copy and pasting in have really hurt.

nberardi wrote  Nov 15 2007 at 4:03 AM  
My biggest problem with the software is the use of the font tag and other out dated methods for rendering HTML. If I was to put the HTML generated from this RTE in my XHTML site any validation tool would through a fit.

esben2000 wrote  Nov 16 2007 at 10:48 PM  
I think that what most of us was expecting was an editor like the FCKEditor containing all the features of that one. But of course that would be a very big job. I think the most important features are XHTML support and possibility to add custom buttons.

skannan wrote  Nov 20 2007 at 2:08 PM  
Thanks for all the feedback. Regarding the XHTML / tag issues in this version I am using browser's in built functionality to do most rich text eidting. Thus the tags are created by respective browser ( IE or FF). You would see different tags created for the same functionality across the browsers for the same reason. In order to support XHTML I would have to not use browser features and do all tag handling myself. That might have implications on supporting the context sensitive menus that you have now. But certainly something to consider for next release. I would also like to take this time to encourage community contributions to this project. Please let me know if you are interested.

chatpadm wrote  Feb 23 at 1:00 PM  
Hi Kannan, first of all, thanks for this great control, which is much needed.
secondly, a couple of issues:-
1. Height and Width properties dont work properly.
A. If I set a lower than default width, the toolbars sort-of crumple up. A better solution would be if the tools bars could cascade or simply if hz scroll bar comes into play.
B. If I set lower than default height, the two tabs at the bottom (HtmlView, textView) become detached and stay at default position. There is some kind of hard-coding of their position in the code somewhere. Also, the v-scrolling does not work properly in this case, and text sort-of goes behind tool bars, and one of the tool-bars floats-up but others stay in place. Very ugly effect. I "solved" the issue for my own purpose by changing this line in Rte.cs line 247
iFrame.Style.Add(HtmlTextWriterStyle.Height, "500px");
I changed 500 to 300 (which is what I needed for my project) and recompiled, but obviously this is not a proper solution. I tried setting it to "100%" and "auto", and even commenting out the line, but it didn't help. Ideally, it should respond intelligently to setting the height/width to a % figure when control is embedded inside a table or frame (which is what I am doing with it).
2. It is not clear how to get text into and out of the control programatically (eg to read/write from a server side document). I looked at the sample web-site, but the way it is done there looks like a hack...is there a better way? Maybe using the Text property? It would be nice if this could be documented in your ppt.
3. At a later stage, it would be nice if you could add native support for an xml document format (eg OpenDoc), so that it would be possible to provide editing of documents thru this control. Of course, I guess I could do it programatically right now using XSLT, but native support would make life easier, as I am not sure if there would be round-trip data/format-loss problems with XSLT approach.
Thanks
chat

chatpadm wrote  Feb 24 at 7:15 PM  
Hi Kannan, some more issues....I am trying to use RTE in an AJAX project. I have a tree control in an UpdatePanel, and clicking on the tree nodes causes text to change in the RTE control which is in another frame inside another UpdatePanel. I set the Text Property of RTE in the Selected-Event callback. This does not work...RTE displays nothing, and sometimes freezes up and/or throws an unknown exception if done repeatedly. I have tried to recreate it very simply within the RTE Sample web page....
Add the following to Default.aspx below your Submit button...
<input type="submit" onclick="CopyText()" value="Post" /> ////old submit btn
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>

Add the following code behind...
protected void Button1_Click(object sender, EventArgs e)
{
Rte1.Text += "test test test!!";
}

Run it, click on Button1 and nothing happens (RTE also freezes)...Now remove the "UpdatePanel" and it starts working...
I would appreciate if you could fix this...If I dont use UpdatePanel, it takes ages for my page (which is very complex) to render,
and having that happen at each click of the selection tree is awful.

2. If I dont use "ValidateRequest=false" in the PAGE directive, (which you seem to have done in the sample webpage), I get a dangerous code exception. Why is this? This is a little worrying...

3. If I include an image tag - If I put a relative path (src="images/xyz.jpg") it doesnt show...but it does show if I put in the full url...thanks
chat

rahulsurya wrote  Mar 3 at 4:39 PM  
can we create mergetags in this editor?

naren31 wrote  Mar 24 at 5:20 AM  
Hi friends, need some urgent help.
I was having trouble tabbing to a rich text control field, I focus and the screen moves up instead[scrolls up]. I am unable to tab a RTC field, it takes 2 tabs for me to land myself in the editor, where could the problem lie? Thanks.

shinyzhu wrote  Apr 18 at 1:56 AM  
it looks like the forums of microsoft.

tjbro wrote  May 1 at 12:42 PM  
Can someone explain to me what happens when the user add's a picture. How does it save it? If I were dropping the content from this to an xml file would it just put an HTML <img> tag referencing the file location on the server?

tavogardo wrote  May 2 at 12:21 PM  
I, like lots of folks out there have been trying to find a solution that I can use. This one is interesting, but has some serious flaws in it, that make it not practical. You cannot control the height and width of the rte box. These sizes are hardcoded into rte.cs and do not take into account the values coded into the actual editor that is being requested. It also seems that if you do code them in, what you really do is shrink down the icons used to control all of the parameters, instead of calculating the number o lines that will be needed and having them break and flow.

So, while some aspects are nice, the above make it a non-usable solution for me.

olenikm wrote  Jun 9 at 9:23 PM  
I agree. It's a fantastic control but the sizing issues break it. What I would really like to see, is a detached, centralized edit bar. That way you could have multiple RTE boxes but just one editing bar. For example, I want to have a form with maybe half a dozen RTE boxes on it, but each one can't have it's own toolbar. If the toolbar was at the top of the page and shared among RTE boxes, it would work perfectly.

rvera001 wrote  Jun 13 at 8:48 PM  
Overall, I think this control is pretty sweet. It preforms at a pretty nice speed and can really save a lot of time. Is there any chance of adding the abilty to attach files?

Updating...