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

Insert text into rad editor at cursor position.

2 Answers 243 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Danny
Top achievements
Rank 1
Danny asked on 03 Jun 2012, 01:31 AM
I have setup a page with rad editor. I have a related a customer combo box on the menu on the rad editor. I have not put any code or anything being the custom dropdow box. Basically, what I want to do is, any time an item is selected from the combo, the contents of the combo are inserted into the rad editor. The important part is, the contents are inserted into the place of the cursor.

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 05 Jun 2012, 11:38 AM
Hi Danny,

Try the following code snippet to achieve your scenario.

ASPX:
<telerik:RadEditor ID="RadEditor1" runat="server" OnClientCommandExecuting="OnClientCommandExecuting" >
            <Tools>
                <telerik:EditorToolGroup >
                    <telerik:EditorSplitButton Name="addData" Text="addData">
                        <telerik:EditorDropDownItem Name="one" Value="one" />
                           .................................................
                    </telerik:EditorSplitButton>
                </telerik:EditorToolGroup>
            </Tools>
 </telerik:RadEditor>

JS:
<script type="text/javascript" >
        function OnClientCommandExecuting(sender, args)
        {
            var val = args.get_value();
            var name = args.get_name();
            if (name == "addData")
            {
                sender.pasteHtml(val);
                args.set_cancel(true);
            }
        }
 </script>

Thanks,
Shinu.
0
Danny
Top achievements
Rank 1
answered on 04 Jul 2012, 04:23 AM
Thank you very much. This works great!
Tags
Editor
Asked by
Danny
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Danny
Top achievements
Rank 1
Share this question
or