开发者

asp.net mvc multiple fckeditors field

开发者 https://www.devze.com 2023-01-01 01:00 出处:网络
how to add multiple fckeditor field on asp.net mvc page ok here is the code <% foreach (var OrganizationMeta in ((IEnumerable<Egovt.Models.OrganizationMeta>)ViewData[\"OrganizationMeta\"]))

how to add multiple fckeditor field on asp.net mvc page

ok here is the code

   <% foreach (var OrganizationMeta in ((IEnumerable<Egovt.Models.OrganizationMeta>)ViewData["OrganizationMeta"])) { %>

        <% if (OrganizationMeta.vcr_DateType == "t开发者_运维知识库ext")     { %>
        <% TempData["OrganizationMeta"] = OrganizationMeta.vcr_MetaKey + Lang.int_LangId; %>
        <% Html.RenderPartial("ControlRender"); %>
        <% } %>
        <% } %>
    </div>

controlrender

<script src="<%= Url.Content("~/Content/js/fck/fckeditor.js") %>" type="text/javascript"></script>
            <script type="text/javascript">

                window.onload = function()
                {
                    var sBasePath = '<%= Url.Content("~/Content/js/fck/") %>';
                    var oFCKeditor = new FCKeditor('<%=TempData["OrganizationMeta"] %>');
                    oFCKeditor.BasePath = sBasePath;
                    oFCKeditor.ReplaceTextarea();
                }
            </script>
         <%= Html.TextArea(TempData["OrganizationMeta"].ToString(),"", new { @name = TempData["OrganizationMeta"] })%>

How will i implement it


I think that the error is that you over write the onload.

this is a fast solution

<script src="<%= Url.Content("~/Content/js/fck/fckeditor.js") %>" type="text/javascript"></script>
<%= Html.TextArea(TempData["OrganizationMeta"].ToString(),"", new { @name = TempData["OrganizationMeta"] })%>
<script type="text/javascript">
{
  var sBasePath = '<%= Url.Content("~/Content/js/fck/") %>';
  var oFCKeditor<%=TempData["OrganizationMeta"] %> = new FCKeditor('<%=TempData["OrganizationMeta"] %>');
  oFCKeditor<%=TempData["OrganizationMeta"] %>.BasePath = sBasePath;
  oFCKeditor<%=TempData["OrganizationMeta"] %>.ReplaceTextarea();
}
</script>

Hope this works, because the other is for the version 3.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号