Reputation: 1201
I have a controller action like this:
public ActionResult Test(string par)
{
Model myMod = new Model();
myMod.Attribute = par;
return View(myMod);
}
In the Test View I'd like to retrieve and print that attribute...
like this:
@model Project.Models.Model
@Html.DisplayFor(model => model.Attribute)
But by doing in that way I'm not able to retrieve the data from the action.
Upvotes: 0
Views: 140
Reputation: 9901
In your model, the property is called, Attribute
, but in the view, you are referencing Attrubute
:
@Html.DisplayFor(model => model.Attribute)
Upvotes: 2