2
var editCommentDiv = '<div id="divTicketCommentHistoryEditor">';
editCommentDiv += '<br />';
editCommentDiv += '<telerik:RadEditor ID="editorCommentsHistory" runat="server" EditModes="Design" ToolbarMode="ShowOnFocus" ToolsWidth="170px" Width="412px" Height="72px"></telerik:RadEditor>';

editCommentDiv += '<div>';
editCommentDiv += '<input id="cbEditIsPrivate" type="checkbox" />Make Comment/Note Private';
editCommentDiv += '&nbsp;';
editCommentDiv += '<a href="javascript:void(0)" onclick="return editCommentSave();">Update</a>';
editCommentDiv += '<a href="javascript:void(0)" onclick="return editCommentCancel();">Cancel</a>';
editCommentDiv += '</div></div>';

I'm getting unterminated string literal here

<telerik:RadEditor ID="editorCommentsHistory" runat="server" EditModes="Design" ToolbarMode="ShowOnFocus" ToolsWidth="170px" Width="412px" Height="72px"></telerik:RadEditor>' 
user3792804
  • 37
  • 10
  • What do you want to achieve by registering RadEditor with JavaScript? Have in mind that the RadEditor is a server control and its tag should be parsed by ASP.NET Web Forms engine in order to serve its HTML, JavaScript and CSS to the browser. – Rumen Jekov May 28 '15 at 15:11
  • I want create a RadEditor control dynamically on button click using client side coding...Is that possible? – user3792804 May 28 '15 at 17:01

2 Answers2

1
    public string editor(){
           RadEditor editor = new RadEditor();
            editor.ID = "radeditor";
//provide all the properties and toolbar options
            StringWriter sw = new StringWriter();
            HtmlTextWriter htWriter =new HtmlTextWriter(sw);
            editor.RegisterWithScriptManager = false;
            this.Controls.Add(editor);
            editor.RenderControl(htWriter);

            string strRenderedHTML = sw.ToString();
            return strRenderedHTML;
    }

finally stored the returned string in a hidden field (contains all html of Radeditor)and get value in .aspx page.

editCommentDiv += hiddenfield.value..

user3792804
  • 37
  • 10
0

RadEditor for ASP.NET AJAX is a server control and it cannot be created on the client.

You need to put it on the page declaratively () or create it in the code behind and add it to the controls collection of another control. This is required because all the HTML code for the control (toolbars, skin CSS, etc.) is rendered and sent by the sever.

Rumen Jekov
  • 1,665
  • 2
  • 17
  • 19