I am working on MVC-3. In my opinion, I came across the following exception:
cannot perform runtime binding on a null reference
Model class
public class HomeModel { public IEnumerable<Html> Template { get; set; } }
Code view
@model Project.Models.HomeModel @{ ViewBag.Title = "Home Page"; int i = 0; } <div class="container"> @foreach (var e in Model.Template)
controller
public ActionResult Index() { HomeModel model = new HomeModel(); model.Template = db.Templates(); return View(model); }
My view is strongly typed for the HomeModel model class. Can someone help me solve this problem?
user1740381
source share