Custom control(custom table) and drag it on to radeditor

289 Views Asked by At

I want to design a custom control which is having html text and drag it on to radeditor(eg: drag and drop a custom table created with default css)

May i know how to do this?

Thanks

2

There are 2 best solutions below

2
hud On

I am still not getting what you want, but from your question may be you want something to design the controls. But it is paid version

Telerik link

0
rdmptn On

Start by examining this to see how you can listen to the drop event in the editor content area and use its pasteHtml() method to add the content you want: http://demos.telerik.com/aspnet-ajax/editor/examples/treeviewandeditor/defaultcs.aspx

Without a control to provide you the drop event, you need to attach it yourself: http://www.telerik.com/help/aspnet-ajax/editor-attacheventhandler.html. Here is a sample:

        <script type="text/javascript">
            function OnClientLoad(editor, args) {
                editor.attachEventHandler("drop", function (e) {
                    alert(e);
                                            editor.pasteHtml(e.srcElement.toString());
                });
            }
        </script>
        <telerik:RadEditor runat="server" ID="RadEditor1" OnClientLoad="OnClientLoad">
        </telerik:RadEditor>

So, with this, you can generate the content you like. NOTE: some browser will handle drag and drop by themselves and add elements to the content.

Another option is to create a custom comamnd that will directly insert your desired HTML if it is static: http://www.telerik.com/help/aspnet-ajax/editor-adding-your-own-buttons.html.