ASP.NET MVC 3: New @model keyword in Razor
page 3 of 7
by Scott Guthrie
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 33576/ 72

New @model directive

Let’s now look at a new feature we added with the ASP.NET MVC 3 Beta – the @model directive.  The @model directive provides a cleaner and more concise way to reference strongly-typed models from view files.

To see this in action, let’s look at a (super) simple scenario where we want to implement a /Products URL that lists product categories from a database:


Below is a simple ProductsController implementation that implements the /Products URL.  It retrieves a list of product categories from a database, and then passes them off to a view file to render an appropriate HTML response back to the browser:


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2021  |  Page Processed at 2021-03-02 8:44:54 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search