Applying style to textbox

2 posts, 1 answers
  1. sumither
    sumither avatar
    13 posts
    Member since:
    Apr 2011

    Posted 26 Apr 2011 Link to this post

    Hi.. 
    How to set the cssclass attribute while inserting the textbox control in radeditor..?
  2. Answer
    Rumen
    Admin
    Rumen avatar
    14084 posts

    Posted 26 Apr 2011 Link to this post

    Hello Sumither,

    You can use the OnClientPasteHtml event of RadEditor to apply a className to the inserted textbox element, e.g.

    <script type="text/javascript">
        function OnClientPasteHtml(sender, args) {
            var commandName = args.get_commandName();
     
            var value = args.get_value();
     
            if (commandName == "InsertFormElement") {
                if (value.match("<input")) {
                    value = value.replace("<input", "<input className='myClass' ");
                }
                args.set_value(value);
            }
        }
    </script>
    <telerik:RadEditor runat="server" OnClientPasteHtml="OnClientPasteHtml" ID="RadEditor1"></telerik:RadEditor>


    All the best,
    Rumen
    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.

Back to Top