asp.net-mvc - View.Title == ViewData ["Title"]

标签 asp.net-mvc asp.net-mvc-3 razor

我现在对 ASP.NET MVC 的 Razor ViewEngine 感到困惑。

大多数人会说:

View.Title

相同
ViewData["Title"]

运行应用程序后我得到了这个

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

什么给了?我错过了什么? 我正在使用 VWD 2010 Express + ASP.NET MVC 3 R2

最佳答案

在最新的 RC 中已改为 ViewBag。

ViewBag.Title = "Test";

ScottGu's post关于最新 MVC 3 候选版本中的重大更改。

关于asp.net-mvc - View.Title == ViewData ["Title"],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4441422/

相关文章:

c# - 在 asp.net mvc 项目中更新时遇到问题

c# - Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) 返回 String.Empty

visual-studio-2010 - Razor Intellisense 不工作 VS2010 SP1Rel MVC3 来自 WPI Win7 x64

c# - ASP.NET MVC下无法使用C#设置和获取cookie

asp.net-mvc - 在 Controller 中创建 jstree jquery_ajax

c# - ASP .NET MVC 在每个字段级别禁用客户端验证

javascript - Razor Dropdown onchange 事件未触发始终未定义

jquery - 无法使编辑器模板工作

javascript - 在 jquery 模态对话框中获取文本框的值

javascript - 将 Razor View 中的值提交给通过 HTTP Post 方法接受值的 Controller 操作