views:

35

answers:

1

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 == "text")     { %>
        <% 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

+1  A: 

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.

Aristos