I'm testing scenario for one of Component it is having RTF field.
In the RTF field I have added image and preview the Component with respective Component Template without any issue JSON is populated and inserted the same Component to the Page and preview the Page that is also populating fine.
When I hit page getting an error "A problem occurred while rendering this section"
Please provide me your inputs
# Model
public class Article : EntityModel
{
public List<_Article> Articles { get; set; }
}
public class _Article : EntityModel
{
public string Title { get; set; }
public string Article_Text { get; set; }
public Image Image { get; set; }
public string Image_Position { get; set; }
}
# View
if (Model.Articles != null)
{
foreach (var article in Model.Articles)
{
if (article.Image != null)
{
if (article.Image_Position.ToLower() == "left")
{
<div class="article">
<div @Html.DxaPropertyMarkup(() => article.Image)>
<img src="@article.Image.Url" alt="@article.Image.Alternate_Text" />
</div>
<div class="article-content">
@if (article.Title != null)
{
<div>
@Html.DxaPropertyMarkup(() => article.Title)>
<h2> @article.Title</h2>
</div>
}
<hr class="article-underline" />
@if (article.Article_Text != null)
{
<div @Html.DxaPropertyMarkup(() => article.Article_Text)>
@Html.DxaRichText(article.Article_Text)
</div>
}
</div>
<div class="clear"></div>
</div>
}
added right logs find out this error
ERROR - Unable to map field 'article' to property of type 'WFA.Web.Site.Models._Article'.
Sdl.Web.Common.DxaException: Unable to map field 'article' to property of type 'WFA.Web.Site.Models._Article'. ---> Sdl.Web.Common.DxaException: Unable to map field 'article_text' to property of type 'System.String'. ---> System.MissingMethodException: Cannot create an abstract class.
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at Sdl.Web.Tridion.Mapping.DefaultRichTextProcessor.ResolveRichText(XmlDocument doc, Localization localization) in c:\Users\U448276\Desktop\Temp\DotNet\R4.16\Trunk\Sdl.Web.Tridion\Mapping\DefaultRichTextProcessor.cs:line 116
at Sdl.Web.Tridion.Mapping.DefaultRichTextProcessor.ProcessRichText(String xhtml, Localization localization) in c:\Users\U448276\Desktop\Temp\DotNet\R4.16\Trunk\Sdl.Web.Tridion\Mapping\DefaultRichTextProcessor.cs:line 46
at Sdl.Web.Tridion.Mapping.DefaultModelBuilder.MapFieldValues(IField field, Type modelType, Boolean multival, MappingData mapData) in c:\Users\U448276\Desktop\Temp\DotNet\R4.16\Trunk\Sdl.Web.Tridion\Mapping\DefaultModelBuilder.cs:line 633
--- End of inner exception stack trace ---