0

アプリを開発し、それにリッチ テキスト エディターを追加していますが、機能していません。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>

私を助けてください。

4

3 に答える 3

1

AJAXControlsToolkitのHTMLエディターを使用できます

于 2012-04-30T08:01:57.040 に答える
0

jquery でCK エディターを使用する非常に簡単な方法を次に示します。

  1. 必要なjsファイルを含めます
/Editors/ckeditor/ckeditor.js", "/Editors/ckeditor/adapters/jquery.js"
  1. ID「txtHtmlContent」で textarea 要素を作成します
<textarea cols="50" rows="5" id="txtHtmlContent" class="sfTextarea"> </textarea>
  1. プラグイン メソッドを呼び出す

$('#txtHtmlContent').ckeditor("config");

于 2012-04-30T07:56:18.647 に答える
0

Yahoo User Interface Library の Rich Text Editorも参照してください。

于 2012-05-01T10:08:14.443 に答える