Reputation: 13
First of all, when I right click on the Action Result method name there is no option for creating a view, only "Go to view" even it doesn't exist.
I added a view to the folder by "Add" -> "MVC 5 View Page (Razor)", but in dialog window I can type only the name
How to create a strongly-typed view?
Upvotes: 0
Views: 453
Reputation: 6725
In recent update to web developer tooling they re added this functionality for mvc5/4 projects. https://get.asp.net/
Upvotes: 1
Reputation: 972
You can use the @model
directive to specify the type.
Example:
public class MyModel
{
public string MyString { get; set; }
}
The view:
@model MyModel
<p>@Model.MyString</p>
http://weblogs.asp.net/scottgu/asp-net-mvc-3-new-model-directive-support-in-razor
Upvotes: 0