javascriptjqueryrad-controlsradeditor

Adding RadEditor using javascrpt:getting unterminated string literal error


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>' 

Solution

  •     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..