It has worked previously, but suddenly stopped working.
There is a node with id 1092, and a foreach loop gives me the childnodes.
Umbraco v 7.1.4
Server Error in '/' Application.
'Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Count'
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Count'
Source Error:
Line 17:
Line 18:
Line 19: @Umbraco.Content(1092).Children.Count()
Line 20: @foreach(var page in Umbraco.Content(1092).Children){
Line 21: @page.Name
Source File: e:\obfuscated-path-to-solution\Views\Partials\userlist.cshtml Line: 19
Stack Trace:
[RuntimeBinderException: 'Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Count']
CallSite.Target(Closure , CallSite , Object ) +376
System.Dynamic.UpdateDelegates.UpdateAndExecute1(CallSite site, T0 arg0) +924
ASP._Page_Views_Partials_userlist_cshtml.Execute() in e:\obfuscated-path-to-solution\Views\Partials\userlist.cshtml:19 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +125
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +196
Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer) +140
System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +147
ASP._Page_Views_Brugerliste_cshtml.Execute() in e:\obfuscated-path-to-solution\Views\Brugerliste.cshtml:14 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +125
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +181
Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer) +140
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +380
System.Web.Mvc.<>c__DisplayClass1a.b__17() +33
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +263
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +720
System.Web.Mvc.<>c__DisplayClass1d.b__19() +40
System.Web.Mvc.Async.<>c__DisplayClass1.b__0() +15
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +15
System.Web.Mvc.<>c__DisplayClass8.b__3(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +15
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446
Count() stopped working
The statement
produces this error below.
It has worked previously, but suddenly stopped working.
There is a node with id 1092, and a foreach loop gives me the childnodes.
Umbraco v 7.1.4
Well this works
But this does not
So I've solved my problem, but I think this might be a bug.
I've found this post similar to my problem
http://our.umbraco.org/forum/umbraco-7/using-umbraco-7/49889-UmbracoWebModelsDynamicPublishedContentList-does-not-contain-a-definition-for-Count
The user mentions that .NiceUrl() also stopped working, I tested that and .NiceUrl() only worked with Umbraco.TypedContent().
It is mentioned that is is fixed in v. 7.1.1, but I'm on 7.1.4 and seeing the same problem.
But for anyone else with the problem, use Umbraco.TypedContent as a workaround.
is working on a reply...