What is strongly-typed View in ASP.NET MVC?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is an aspx page that derives from
System.Web.Mvc.ViewPage<TModel>. It is said that this view is strongly typed to the typeTModel. As a consequence to this there’s a Model property inside this view which is of typeTModeland allows you to directly access properties of the model like this:where as if your aspx page derived from
System.Web.Mvc.ViewPageyou would need to pull values fromViewDatathe view no longer knows about theTModeltype:or even worse:
and there’s no compile time safety in such code.
Notice also that there’s the
ViewUserControl<TModel>counterpart for strongly typed partials (ASCX).