添加 RadEditor 使用 javascrpt:getting 未终止的字符串文字错误
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 += ' ';
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>';
我在这里得到未终止的字符串文字
<telerik:RadEditor ID="editorCommentsHistory" runat="server" EditModes="Design" ToolbarMode="ShowOnFocus" ToolsWidth="170px" Width="412px" Height="72px"></telerik:RadEditor>'
RadEditor for ASP.NET AJAX 是服务器控件,不能在客户端创建。
您需要以声明方式将其放在页面上() 或在代码后面创建它并将其添加到另一个控件的控件集合中。这是必需的,因为控件的所有 HTML 代码(工具栏、皮肤 CSS 等)都由服务器呈现和发送。
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;
}
最终将返回的字符串存储在隐藏字段中(包含 Radeditor 的所有 html)并在 .aspx 页面中获取值。
editCommentDiv += hiddenfield.value..
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 += ' ';
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>';
我在这里得到未终止的字符串文字
<telerik:RadEditor ID="editorCommentsHistory" runat="server" EditModes="Design" ToolbarMode="ShowOnFocus" ToolsWidth="170px" Width="412px" Height="72px"></telerik:RadEditor>'
RadEditor for ASP.NET AJAX 是服务器控件,不能在客户端创建。
您需要以声明方式将其放在页面上() 或在代码后面创建它并将其添加到另一个控件的控件集合中。这是必需的,因为控件的所有 HTML 代码(工具栏、皮肤 CSS 等)都由服务器呈现和发送。
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;
}
最终将返回的字符串存储在隐藏字段中(包含 Radeditor 的所有 html)并在 .aspx 页面中获取值。
editCommentDiv += hiddenfield.value..