Intellisense errors in Views\ShoppingCart\Index.cshtml

Aug 21, 2012 at 5:18 PM

Although I have

@model IEnumerable<MVCMusicStore.ViewModels.ShoppingCartViewModel


 at the top of the index file, CartItems and CartTotal or not being recognized by Intellisense as being defined anywhere.  They are defined in the ShoppingCartViewModel exactly as in the tutorial.

I cannot find a reason for this, and could use some help.

Nathan Manning


Sep 13, 2012 at 8:53 AM

Just comparing this to my code, Views/ShoppingCart/Index.cshtml doesnt have the IEnumerable.

That then explains why you cant access the data items (and IntelliSense doesnt work) as you are telling the view that its expecting a list of items, which you would then have to have a foreach for to access the actual fields for each object. So unless you're customising the code, just remove the IEnumerable.

Dec 24, 2012 at 2:26 PM

nutter99, thx!