Currently i am using variables inside my view that have been declared within a model, and assigned values within the respective controller. I am using Model.variableName to reference these variables, however the following exception is thrown during debugging;
I am using the following namespaces within my view;
@using ProjectName.Models
@model Category
My class model;
public class Category
{
public string result { get; set; }
}
My controller;
public ActionResult Index()
{
return View();
}
[HttpGet]
public ActionResult ReadCategory()
{
var dataFile = Server.MapPath("~/App_Data/Category.txt");
Category passCategory = new Category
{
result = "",
delimiterChar = new[] { ',' },
userData = System.IO.File.ReadAllLines(dataFile)
};
return View(passCategory);
}
Any help would be greatly appreciated!
