Add custom styling to attribute

3 posts, 0 answers
  1. Dave
    Dave avatar
    2 posts
    Member since:
    May 2011

    Posted 04 May 2011 Link to this post

    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. Stanimir
    Admin
    Stanimir avatar
    1654 posts

    Posted 05 May 2011 Link to this post

    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.

  3. Dave
    Dave avatar
    2 posts
    Member since:
    May 2011

    Posted 06 May 2011 Link to this post

    Hi Stanimir,

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

    Cheers

    Dave Clayton
Back to Top