Click here to Skip to main content
13,249,813 members (86,228 online)
Rate this:
 
Please Sign up or sign in to vote.
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 14-Dec-12 22:29pm
Updated 16-Dec-12 20:38pm
v2
Comments
Krunal Rohit 15-Dec-12 3:31am
   
Elaborate your question...
-Krunal R.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hi,
You can do this using Javascript
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 :)
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.171114.1 | Last Updated 29 Jun 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100