This is a migrated thread and some comments may be shown as answers.

Add custom styling to attribute

2 Answers 131 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 04 May 2011, 05:37 PM
This may seem like a strange request but here goes.  I want to be able to customise the editor to allow a user to choose a pre-defined style.  For example "Paragraph Red".  I am sure this is pretty simple and the behaviour i would expect would be the HTML to look something like this:

<p class="Paragraph Red">This is some test text</p>

However, what i want to do is allow the user to choose "Paragraph Red" but the generated HTML to add a style tag to the selected element with the style information from the predefined style.  E.g.

<p style="color: red">This is some test text</p>

My reason for doing this is i want to build a user friendly interface for generating our HTML newsletters.  Unfortunately a lot of mail clients (especially the web based ones) require inline styles to be used for the output to be rendered correctly.

2 Answers, 1 is accepted

Sort by
0
Stanimir
Telerik team
answered on 05 May 2011, 03:49 PM
Hello Dave,

Check the following example:
<telerik:RadEditor runat="server" ID="RadEditor1" >
    <Paragraphs>
        <telerik:EditorParagraph Tag="<p style='color: red;'>" Title="<p style='color: red;'>red Paragraph</p>"/>
        <telerik:EditorParagraph Tag="<p style='color: green;'>" Title="<p style='color: green;'>green Paragraph</p>"/>
        <telerik:EditorParagraph Tag="<p style='color: blue;'>" Title="<p style='color: blue;'>blue Paragraph</p>"/>
    </Paragraphs>
</telerik:RadEditor>



I created a small video where you can see how it works: http://screencast.com/t/OQbAJC7T


Regards,
Stanimir
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Dave
Top achievements
Rank 1
answered on 06 May 2011, 01:27 PM
Hi Stanimir,

Thank you very much for your response. That is exactly what i was looking for.

Cheers

Dave Clayton
Tags
Editor
Asked by
Dave
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
Dave
Top achievements
Rank 1
Share this question
or