Donate

The name 'ViewData' does not exist in the current context

Good Evening!

In an application where I played the class diagram in visual studio by adding controller class, repository class, and service class, I encountered an error "The name 'ViewData' does not exist in the current context" in my HomeController.

This is weird since the controller references System.Web.Mvc. The solution is:

1. Copy the source code in the HomeController and transfer it in a textfile for backup.
2. Delete the original HomeController.
3. Add another HomeController class
4. paste the backup code from the textfile.

I guess this is a bug when using class diagrams in Visual Studio 2010.

Greg

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

TypeScript Error Or Bug: The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program.