Exception in Glass mapper for Sitecore in PageEditor mode
For the code:
strMenuText.Append(RenderLink(mainlinkitem, x =>
x.NavigationItem.Url.StringToLink(), isEditable: true, contents:
mainlinkitem.NavigationTitle));
Here mainlinkitem is Navigation object for interface created for data
template. I am using interfaces in this case and castle windsor creates
dynamic proxy objects for this.
Things work ok until I try to use Page editor mode and below error shows
up from glass mapper api.
Expression doesn't evaluate to a member
x.NavigationItem.Url.StringToLink()</p><pre> at
Glass.Mapper.Sc.GlassHtml.MakeEditable[T](Expression`1 field, Expression`1
standardOutput, T model, String parameters, Context context, Database
database, TextWriter writer)</pre>
Note: StringToLink is extension method for converting external url in
string form to Glass mapper Glass.Mapper.Sc.Fields.Link type.
public static Link StringToLink(this string urlvalue)
{
Link itemLink = new Link();
itemLink.Url = urlvalue;
return itemLink;
}
No comments:
Post a Comment