Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does View.Title == ViewData["Title"] result in an error: "The name 'View' does not exist in the current context"?

I am confused with Razor ViewEngine for ASP.NET MVC.

most of you would say:

View.Title

is the same with

ViewData["Title"]

after running the application I get this

Compiler Error Message: CS0103: The name 'View' does not exist in the current context

what gives? did I miss something? am using VWD 2010 Express + ASP.NET MVC 3 R2

like image 934
AceMark Avatar asked Nov 04 '25 16:11

AceMark


1 Answers

It's been changed to ViewBag in the latest RC.

ViewBag.Title = "Test";

See ScottGu's post on breaking changes in the latest MVC 3 release candidate.

like image 139
Nick Patterson Avatar answered Nov 06 '25 06:11

Nick Patterson