I have an Image Cropper Extended on a doc type with an property alias of Crops. There is an associated upload property (called uploadImage) on the doctype and the image cropper is showing up and working fine. I used the Razor snippes example from the ImageCropperExtendedDocumentation_v2.
Error Loading Razor Script (file: Get Crops) 'umbraco.MacroEngines.DynamicXml' does not contain a definition for 'newurl' at CallSite.Target(Closure , CallSite , Object ) at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0) at ASP._Page_macroScripts_GetCrops_cshtml.Execute() in c:\inetpub\wwwroot\BedrockCMS\MacroScripts\GetCrops.cshtml:line 15 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.WebPages.WebPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage) at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)
I've also tried .url and get the same error. Am I missing something?
I think the error is caused by @if(Model.Crops != null), because the property is not null if it is defined on the document type. But we need to check whether the value is not empty too. Change the if clause to: @if (Model.HasValue("Crops"))
Cropper on document type returns error on newurl
I have an Image Cropper Extended on a doc type with an property alias of Crops. There is an associated upload property (called uploadImage) on the doctype and the image cropper is showing up and working fine. I used the Razor snippes example from the ImageCropperExtendedDocumentation_v2.
@if (Model.Crops != null) {
<img src="@Model.Crops.Find("@name","Portrait").newurl" />
}
This is throwing an error:
Error Loading Razor Script (file: Get Crops) 'umbraco.MacroEngines.DynamicXml' does not contain a definition for 'newurl' at CallSite.Target(Closure , CallSite , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at ASP._Page_macroScripts_GetCrops_cshtml.Execute() in c:\inetpub\wwwroot\BedrockCMS\MacroScripts\GetCrops.cshtml:line 15
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.WebPages.WebPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage)
at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)
I've also tried .url and get the same error. Am I missing something?
I think the error is caused by @if(Model.Crops != null), because the property is not null if it is defined on the document type.
But we need to check whether the value is not empty too. Change the if clause to: @if (Model.HasValue("Crops"))
Dirk
I updated the docu too.
That indeed was the issue. Works like a charm now. Thank you for the quick response.
is working on a reply...