I have a solution with two projects.
One of them contains data access layer classes (DAL.dll), and the other one is an ASP.NET MVC project. The ASP.NET MVC project depends on DAL.dll. I want to use the DAL.dll classes in a model class in the ASP.NET MVC project.
Suppose that I have a class in DAL.dll as follows:
public class Test{
public string Description{get;set;}
}
And, in the ASP.NET MVC project I have a model class that uses Test.cs as follows:
public class ModelClass{
Test CrudModel{get;set;}
public string Description{get;set;}
}
And, in my view (*.cshtml) I have following code:
@Html.EditorFor(model => model.CrudModel.Description, "tinymce_jquery_min")
In the above code, @Html.EditorFor
does not render "tinymce_jquery_min" template.
But, when I use the following code, @Html.EditorFor
does render "tinymce_jquery_min" template:
@Html.EditorFor(model => model.Description, "tinymce_jquery_min")
Why @Html.EditorFor only renders template for properties those are in model class in the ASP.NET MVC project and not for properties in a different dll?
Updated
"tinymce_jquery_min" template is as follow :
<script src="@Url.Content("~/Scripts/tinymce/jquery.tinymce.js")" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
setTimeout(loadTinyMCE, 500);
});
function loadTinyMCE() {
$('#@ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty)').tinymce({
script_url: '@Url.Content("~/Scripts/tinymce/tiny_mce.js")',
theme: "advanced",
height: "300",
width: "400",
verify_html: false,
theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_statusbar_location: "bottom",
theme_advanced_resizing: false,
convert_urls: false,
template_external_list_url: "lists/template_list.js",
external_link_list_url: "lists/link_list.js",
external_image_list_url: "lists/image_list.js",
media_external_list_url: "lists/media_list.js"
});
}
</script>
@Html.TextArea(string.Empty,
ViewData.TemplateInfo.FormattedModelValue
)