Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Use mvc4, vs2012.
In the .aspx page,there are the source code as blow:
XML
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Manage.Models.Entity.TempInfo>>" %>
......................
foreach (var item in Model)


The variable [Model] means [Manage.Models.Entity.TempInfo].
But my question is why i am not define the [Model],but can use it as a instance of [Manage.Models.Entity.TempInfo].
Posted
Comments
Herman<T>.Instance 22-Oct-14 5:04am    
Because you Inherit?
[no name] 22-Oct-14 5:49am    
It is done by the Razor. The razor uses that inherited code as @model....path to the model. And when Model is used it is referenced as THe same model.
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900