Has anyone else run into such an error? It would be great if anyone can suggest a way to examine this further or maybe has a direction for a solution.
I have tried to debug this but could not figure it out. The action specified in the cshtml file is reached and the posted information is available. The error occurs when this line is executed.
masterService.Save(page);
The WikiEntryModel
does contain a ImageField
. This is not filled in when the form is called up and is also not specified as a field in the form.
Additional information
I am using GlassMapper v2.0 in combination with Sitecore 7.1.
This is the actual error description as displayed on the page.
Method not found: 'System.String Sitecore.Data.Fields.ImageField.get_MediaPath()'.
The cshtml file of the form.
@model WikiEntryModel
@using(Html.BeginRouteForm(Sitecore.Mvc.Configuration.MvcSettings.SitecoreRouteName, FormMethod.Post))
{
@Html.Sitecore().FormHandler("Forms","PostEditWikiEntry")
<ul>
<li>
@Html.LabelFor(model => model.Title)<br />
@Html.TextBoxFor(model => model.Title)
</li>
<li>
@Html.LabelFor(model => model.Introduction)<br />
@Html.TextAreaFor(model => model.Introduction)
</li>
<li>
<input type="submit" value="Save" />
</li>
</ul>
}
The code of the specified action in the controller.
[HttpPost]
public ActionResult PostEditWikiEntry(WikiEntryModel postedModel)
{
var contextService = new SitecoreContext();
var masterService = new SitecoreService("master");
var page = contextService.GetCurrentItem<WikiEntryModel>();
if (ModelState.IsValid)
{
page.Title = postedModel.Title;
page.Introduction = postedModel.Introduction;
using (new SecurityDisabler())
{
masterService.Save(page);
}
}
return RenderComponent<WikiEntryModel>("Forms/Edit wiki entry");
}