This project is read-only.

Error 'The name ViewBag does not exist in current context.'

Jan 14, 2011 at 9:44 PM

I've got the completed solution.  I attached my database.  I'm getting the following build error..

The name 'ViewBag' does not exist in the current context C:\MvcMusicStore2.0Completed\MvcMusicStore\Controllers\AccountController.cs 150 13 MvcMusicStore

Any Ideas?


Jan 14, 2011 at 11:32 PM

I got it fixed.  In the controler classes the 'ViewBag' needed to be changed to 'ViewModel'.  In the Views, the 'ViewBag' needed to be changed to 'View'.  That fixed it, now I'm up and running!!

Jan 15, 2011 at 12:07 AM
Edited Jan 15, 2011 at 12:12 AM

Sounds like you're running a pre-release version of ASP.NET MVC 3. The RTM version of ASP.NET MVC 3 uses ViewBag in codebehind and view code. I recommend you update to the RTM: