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

can't find Editor

2 Answers 114 Views
Editor
This is a migrated thread and some comments may be shown as answers.
rover
Top achievements
Rank 1
rover asked on 29 Sep 2009, 09:20 PM
I have control with 2 elements - Editor and Limiter

 

protected override void CreateChildControls()

 

{

 

base.CreateChildControls();

 

editor =

new RadEditor();

 

editor.Editable =

true;

 

 

//editor.StripFormattingOnPaste = EditorStripFormattingOptions.MSWordRemoveAll;// "All";

 

editor.ToolsFile =

"/radcontrols/editor/ToolsDataFile.xml";

 

editor.RadControlsDir =

"/radcontrols/";

 

 

//UseFixedToolbar=false;

 

editor.ShowPreviewMode =

false;

 

editor.ShowSubmitCancelButtons =

false;

 

editor.SaveInFile =

false;

 

editor.ImagesFilters =

new string[] { "*.gif", "*.jpg", "*.png" };

 

editor.MaxDocumentSize = 5120000;

editor.ShowHtmlMode =

false;

 

editor.EnableContextMenus =

true;

 

editor.ConvertToXhtml =

false;

 

editor.Width =

new Unit(100, UnitType.Pixel);

 

editor.Height =

new Unit(200, UnitType.Pixel);

 

editor.ShowHtmlMode =

true;

 

editor.ID =

string.Concat(ID, "_Editor");

 

 

//editor.ClientID = this.ClientID + "_Editor";

 

editor.StripFormattingOnPaste =

EditorStripFormattingOptions.All;

 

 

//editor.ContextMenus.

 

 

 

//editor.OnClientLoad = "onEditorload";

 

Controls.Add(editor);

limiter =

new CharLimitValidator();

 

limiter.ID =

string.Concat(ID, "_Limiter");

 

limiter.ControlToValidate = editor.ID;

Controls.Add(limiter);


I need to give get_html value outside this control.
I try to following :

 

 

HtmlGenericControl js = new HtmlGenericControl("script");

 

js.Attributes.Add(

"language", "javascript");

 

js.InnerHtml +=

"var editor" + ClientID + " = $find('" + editor.ClientID + "');";

 

js.InnerHtml +=

this.ClientID + ".get_html = function () { return editor" + ClientID + ".get_text(); }";

 

 

//js.InnerHtml = this.ClientID + ".get_html = function () { return 'fff'; }";

 

 

 

 

 

Controls.Add(js);

but this code can't find this editor. Why? Please, help me

2 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 01 Oct 2009, 03:52 PM
If you do:

js.InnerHtml += "var editor" + ClientID + " = $find('_Editor.ClientID');";  

does that change anything?


0
Rumen
Telerik team
answered on 02 Oct 2009, 09:05 AM
Hello Schlurk,

Could you please specify which version of RadEditor use: RadEditor Classic (RadEditor.dll) or RadEditor for ASP.NET AJAX (Telerik.Web.UI.dll)?

In the code that you have posted I noticed that you use RadEditor Classic. To get a reference to RadEditor Classic object please use the code provided in this help article: Getting a Reference to RadEditor.

Kind regards,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Editor
Asked by
rover
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Rumen
Telerik team
Share this question
or