I am having a problem calling a model property from my view. I may have to create an instance of it in the view.
ERROR MESSAGE: Object reference not set to an instance of an object. However inside the model it works fine.
View:
@model site.Models.modeldata
@foreach (System.Data.DataRow row in Model.DataSets["test"].Tables[0].Rows)
{
@:row["id"]
}
Model:
public IDictionary<string, DataSet> DataSets { get; private set;
Your controller should be deciding to include the required data for the view. Refactor to use something other than a dataset.
In your view: