4 August 2013

Dynamic v. Strongly Typed Views in MVC C# Razor Engine

Dynamic vs. Strongly Typed Views

Dynamic
Because we’re using a dynamic and not a strongly typed view, intellisense doesn’t help us. The completed code is shown below:

@model dynamic
         
@ {
    ViewBag.Title = "IndexNotStonglyTyped";
}

Index Not Stongly Typed< /h2 >



< p >
 < ul >
@foreach (var blog in Model) {
   < li >
    < a href="@blog.URL">@blog.Name< /a >
   < /li >  
}
 < /ul >

< /p >

Strongly Typed Views
When it is strongly typed view.

5658.StrongView[1]

Inside the new view template we get intellisense support.

7002.intellesince[1]


No comments:

Post a Comment

Comments Welcome

Implementing OAuth validation in a Web API

 I mplementing OAuth validation in a Web API Implementing OAuth validation in a Web API using C# typically involves several key steps to sec...