Click here to Skip to main content
15,867,964 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I am using vs2008,c#.net web application.

I have one textbox, button and ajax editor control. when i click on button then textbox data should be inserted in ajax editor content with selected cursor position.

how can do this using java script or code.
plz help

Regards
mukesh
Posted
Updated 16-Dec-12 19:38pm
v2
Comments
[no name] 15-Dec-12 3:31am    
Elaborate your question...
-Krunal R.

1 solution

Hi,
You can do this using Javascript
C#
function InsertAtCaret() {
            try {
                var editor = $find("<%= EdPatconsuForm.ClientID %>");//HtmlEditor Id
                editPanel = editor.get_editPanel();
                if (editPanel.get_activeMode() == 0) {
                    var designPanel = editPanel.get_activePanel();
                    designPanel._saveContent();
                    designPanel.insertHTML('your text');///pass your text here
                    setTimeout(function () { designPanel.onContentChanged(); editPanel.updateToolbar(); }, 0);
                    designPanel.focusEditor();
                }
            } catch (e) { alert(e); }
        }

Hope your Problem Will Solve :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900