我正在开发一个应用程序并在其中添加富文本编辑器但它无法正常工作。我也尝试了很多其他编辑器,如tinyMC或CK Editor,但它也没有用。这就是为什么我提供代码以便任何人都可以帮助我。代码正在关注
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Tabs.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="titleContent" runat="server">
PostProblem
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="body" runat="server">
<script src="http://js.nicedit.com/nicEdit-latest.js" type="text/javascript"></script>
<script type="text/javascript"> bkLib.onDomLoaded(nicEditors.allTextAreas);</script>
<script type="text/javascript">
$("#PostProblem").validate();
</script>
<h3>PostProblem</h3>
<br />
<% using (Html.BeginForm("PostProblem", "Discussion", null ,FormMethod.Post, new { id = "PostProblem" }))
{ %>
<table class="bodyTable">
<tbody class="rowHover">
<tr>
<td class="labelPortion">
Title:
</td>
<td class="controlPortion">
<%: Html.RenderControl(new ControlInfo()
{
ControlID = 1,
CanNull = false,
Type = ControlType.TextField,
Value = (TempData["__1"] != null) ? TempData["__1"].ToString() : ""
}, true
)
%>
<% // Display the error message if any.
if (TempData["_1"] != null)
{ %><br/>
<span class="errorMessage"> <%: TempData["_1"]%> </span>
<% } %>
</td>
</tr>
<tr>
<td class="labelPortion">
Problem:
</td>
<td class="controlPortion">
<%: Html.RenderControl(new ControlInfo()
{
ControlID = 3,
CanNull = false,
Type = ControlType.TextArea,
Value = (TempData["__3"] != null) ? TempData["__3"].ToString() : ""
}, true
)
%>
<% // Display the error message if any.
if (TempData["_3"] != null)
{ %>
<br/>
<span class="errorMessage"> <%: TempData["_3"]%> </span>
<% } %>
</td>
</tr>
<tr>
<td class="labelPortion">
<b>Problem Tag:</b>
</td>
<td class="controlPortion">
<%: Html.DropDownList("selectedValue", (IEnumerable<SelectListItem>)ViewData["problemTags"])%>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input class="buttonDesign" type="submit" value="Post"/>
</td>
</tr>
</tbody>
</table>
<%} %>
</asp:Content>
请帮帮我。
答案 0 :(得分:1)
您可以使用HTML Editor
中的AJAX Controls Toolkit答案 1 :(得分:0)
这是在jquery中使用CK editor的一种非常简单的方法。
/Editors/ckeditor/ckeditor.js", "/Editors/ckeditor/adapters/jquery.js"
<textarea cols="50" rows="5" id="txtHtmlContent" class="sfTextarea"> </textarea>
$( '#txtHtmlContent')的CKEditor( “配置”);
答案 2 :(得分:0)