We're doing this to insert text directly into an HTMLEditor on the client-side, using IE9:
var editor = $find("<%=Editor1.ClientID %>");
var editPanel = editor.get_editPanel();
if (editPanel.get_activeMode() == 0) // i.e. we're in the design panel.
{
var designPanel = editPanel.get_activePanel();
designPanel._saveContent(); // For Undo.
designPanel.insertHTML("some text");
setTimeout(function () { designPanel.onContentChanged(); editPanel.updateToolbar(); }, 0);
//var editorControl = $get("<%=Editor1.ClientID %>").control;
//var content = editorControl.get_content();
//editorControl.set_content(content);
designPanel.focusEditor();
}
This works fine and the text appears, but on postback, Editor1.Content does not include the text that's been inserted.
We can uncomment the three lines to refresh the content and this solves the problem, except that the cursor goes to top left and apparently there's no way to put it back!
Thanks for taking the time to reply, Chetan, but it looks as if you're pointing me to basic information about the HTMLEditor.
My point is that I can successfully inject text from JavaScript on the client side, but when I look at the Content after postback this text is not there, at least using IE9.
I'm wondering if anyone else has seen this problem. There's lots of info out there about injecting the text, as I've shown above, but I can't find anything about this text not actually coming back to the server side.
JHSS
0 Points
3 Posts
HTMLEditor designPanel.insertHTML works but text not there in Editor1.Content server-side
Nov 06, 2012 02:32 PM|LINK
We're doing this to insert text directly into an HTMLEditor on the client-side, using IE9:
var editor = $find("<%=Editor1.ClientID %>");
var editPanel = editor.get_editPanel();
if (editPanel.get_activeMode() == 0) // i.e. we're in the design panel.
{
var designPanel = editPanel.get_activePanel();
designPanel._saveContent(); // For Undo.
designPanel.insertHTML("some text");
setTimeout(function () { designPanel.onContentChanged(); editPanel.updateToolbar(); }, 0);
//var editorControl = $get("<%=Editor1.ClientID %>").control;
//var content = editorControl.get_content();
//editorControl.set_content(content);
designPanel.focusEditor();
}
This works fine and the text appears, but on postback, Editor1.Content does not include the text that's been inserted.
We can uncomment the three lines to refresh the content and this solves the problem, except that the cursor goes to top left and apparently there's no way to put it back!
Anyone seen this?
Many thanks.
chetan.sarod...
All-Star
65619 Points
11118 Posts
Re: HTMLEditor designPanel.insertHTML works but text not there in Editor1.Content server-side
Nov 07, 2012 02:32 AM|LINK
Please refer to:http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/HTMLEditor/HTMLEditor.aspx andhttp://www.asp.net/ajaxlibrary/act_HTMLEditor.ashx.
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
JHSS
0 Points
3 Posts
Re: HTMLEditor designPanel.insertHTML works but text not there in Editor1.Content server-side
Nov 07, 2012 07:53 AM|LINK
Thanks for taking the time to reply, Chetan, but it looks as if you're pointing me to basic information about the HTMLEditor.
My point is that I can successfully inject text from JavaScript on the client side, but when I look at the Content after postback this text is not there, at least using IE9.
I'm wondering if anyone else has seen this problem. There's lots of info out there about injecting the text, as I've shown above, but I can't find anything about this text not actually coming back to the server side.
me_ritz
Star
9337 Points
1447 Posts
Re: HTMLEditor designPanel.insertHTML works but text not there in Editor1.Content server-side
Nov 07, 2012 07:58 AM|LINK
When you are injecting text at client-side ; put that text in <asp:hidden/> control....
At the server-side...instead of reading from Editor.Content....read it from that <asp:hiddent/> control...
If i misunderstood you ...please let me know
JHSS
0 Points
3 Posts
Re: HTMLEditor designPanel.insertHTML works but text not there in Editor1.Content server-side
Nov 07, 2012 10:01 AM|LINK
Thanks, and I'm sure there are lots of ways of returning text back to the server.
This issue is specifically about the HTMLEditor and what looks like a bug in its operation under IE9.
Anyone who's experienced this would know instantly, because it's so annoying ;-), and may be able to help me resolve it.