开发者

In ASP.NET MVC 3, what class does Views and Partial Views inherit from?

开发者 https://www.devze.com 2023-01-26 08:11 出处:网络
In ASP.NET MVC 3, what class doe Views and Partial Views inheri开发者_高级运维t from and can the class (presumably it\'s a class somewhere) be inherited from to extend functionality.

In ASP.NET MVC 3, what class doe Views and Partial Views inheri开发者_高级运维t from and can the class (presumably it's a class somewhere) be inherited from to extend functionality.

For example, the default LogOnPartial control has the following (using Razor syntax)

Welcome <b>@Context.User.Identity.Name</b>!

Where is the Context object exposed. What class makes that available to the partial view?


They inherit from System.Web.Mvc.WebViewPage. http://msdn.microsoft.com/en-us/library/system.web.mvc.webviewpage%28VS.98%29.aspx In older versions of razor it was required to add the @inherits but newer versions don't.

0

精彩评论

暂无评论...
验证码 换一张
取 消