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

Applying style to textbox

1 Answer 48 Views
Editor
This is a migrated thread and some comments may be shown as answers.
sumither
Top achievements
Rank 1
sumither asked on 26 Apr 2011, 08:33 AM
Hi.. 
How to set the cssclass attribute while inserting the textbox control in radeditor..?

1 Answer, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 26 Apr 2011, 12:20 PM
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.

Tags
Editor
Asked by
sumither
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or