我有一个视图模型:
public class AutoAdvert
{
//
public Condition condition { get; set; }
}
但是当我在视图中访问它时,它会给出空引用错误。
<div class="editor-label">
@Html.LabelFor(model => model.condition.Tyres)
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.condition.Tyres)
</div>
我要查看的地方:
public ActionResult autoadvert()
{
AutoAdvert autoadvert = new AutoAdvert();
return View(autoadvert);
}