I'm getting this error now, so am I missing something?
Compiler Error Message: CS0118: 'System.Collections.Generic.IDictionary<string,System.Collections.Generic.IEnumerable<Umbraco.Core.Models.IPublishedContent>>' is a 'type' but is used like a 'variable'
Did you get a complete stack trace with your error? if so, can you share that aswell? Also, is your code exactly as above? or could you paste that in aswell, so I can check.
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0118: 'System.Collections.Generic.IDictionary<string,System.Collections.Generic.IEnumerable<Umbraco.Core.Models.IPublishedContent>>' is a 'type' but is used like a 'variable'
Source Error:
Line 1: @{
Line 2: var widgetGridContent = Model.Content.GetPropertyValue<IDictionary<string, IEnumerable<IPublishedContent>>("widgets"); Line 3:
Line 4: }
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18408
Complete Compilation source says this
Line 1: #pragma checksum "E:\ServerPathToUmbraco\Views\Partials\WidgetTest.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "92E838B576845D9AF914DE50440714649AFC128D"
Line 2: //------------------------------------------------------------------------------
Line 3: // <auto-generated>
Line 4: // This code was generated by a tool.
Line 5: // Runtime Version:4.0.30319.18408
Line 6: //
Line 7: // Changes to this file may cause incorrect behavior and will be lost if
Line 8: // the code is regenerated.
Line 9: // </auto-generated>
Line 10: //------------------------------------------------------------------------------
Line 11:
Line 12: namespace ASP {
Line 13: using System;
Line 14: using System.Collections.Generic;
Line 15: using System.IO;
Line 16: using System.Linq;
Line 17: using System.Net;
Line 18: using System.Web;
Line 19: using System.Web.Helpers;
Line 20: using System.Web.Security;
Line 21: using System.Web.UI;
Line 22: using System.Web.WebPages;
Line 23: using System.Web.Mvc;
Line 24: using System.Web.Mvc.Ajax;
Line 25: using System.Web.Mvc.Html;
Line 26: using System.Web.Routing;
Line 27: using Umbraco.Web;
Line 28: using Umbraco.Core;
Line 29: using Umbraco.Core.Models;
Line 30: using Umbraco.Web.Mvc;
Line 31: using Microsoft.Web.Helpers;
Line 32: using umbraco;
Line 33: using Examine;
Line 34: using System.Web.Optimization;
Line 35:
Line 36:
Line 37: public class _Page_Views_Partials_WidgetTest_cshtml : System.Web.Mvc.WebViewPage<dynamic> {
Line 38:
Line 39: #line hidden
Line 40:
Line 41: public _Page_Views_Partials_WidgetTest_cshtml() {
Line 42: }
Line 43:
Line 44: protected ASP.global_asax ApplicationInstance {
Line 45: get {
Line 46: return ((ASP.global_asax)(Context.ApplicationInstance));
Line 47: }
Line 48: }
Line 49:
Line 50: public override void Execute() {
Line 51:
Line 52: #line 1 "E:\ServerPathToUmbraco\Views\Partials\WidgetTest.cshtml"
Line 53: Line 54: var widgetGridContent = Model.Content.GetPropertyValue<IDictionary<string, IEnumerable<IPublishedContent>>("widgets");Line 55: Line 56:
Line 57:
Line 58: #line default
Line 59: #line hidden
Line 60: }
Line 61: }
Line 62: }
Line 63:
Get list of ID's
Hi
Trying to output the stored data, but I just get this
System.Collections.Generic.Dictionary`2[System.String,System.Collections.Generic.IEnumerable`1[Umbraco.Core.Models.IPublishedContent]]
I have seen this
http://our.umbraco.org/projects/backoffice-extensions/widget-grid/bugs,-feedback-and-suggestions/43856-Umbraco-6-compatibility ;
But that honestly does not help that much.
How do I output a list of id's?
Umbraco v 7.1.1
Hi Mihael,
In v7 it already comes back strongly typed as a dictionary, so you can access it like:
From there, you can access the list of cell ids by
Or you can loop through a given cells contents like:
Matt
Hi Matt
Thanks for the quick response.
I'm getting this error now, so am I missing something?
Compiler Error Message: CS0118: 'System.Collections.Generic.IDictionary<string,System.Collections.Generic.IEnumerable<Umbraco.Core.Models.IPublishedContent>>' is a 'type' but is used like a 'variable'
Hi Mihael,
Did you get a complete stack trace with your error? if so, can you share that aswell? Also, is your code exactly as above? or could you paste that in aswell, so I can check.
Many thanks
Matt
Hi Matt
I have this code in a Partial
Which gives this error
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0118: 'System.Collections.Generic.IDictionary<string,System.Collections.Generic.IEnumerable<Umbraco.Core.Models.IPublishedContent>>' is a 'type' but is used like a 'variable'
Source Error:
Line 1: @{ Line 2: var widgetGridContent = Model.Content.GetPropertyValue<IDictionary<string, IEnumerable<IPublishedContent>>("widgets"); Line 3: Line 4: }
Source File: e:\ServerPathToUmbraco\Views\Partials\WidgetTest.cshtml Line: 2
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18408
Complete Compilation source says this
Aah... Theres an error in your code, theres a > missing, I think the text editor is messing it up.
I now have this in a Partial
Which works fine...
Thanks for your quick response...
Ahh, yea, it's a pain keeping track of those :)
Glad you were able to get it to work.
Matt
PS I've updated my first answer with an extra '>'. Feel free to mark it as the answer if that all works for you now.
Many thanks
Matt
EDIT: This works too and is easier to read :-)
Cool, hadn't tried it using dynamic node. Nice to know it works :)
Matt
is working on a reply...