Hi I'm having a problem and I just can't seem to get it around. I want to populate part of my model then pass it to the view so the user can populate the rest and submit.
Here's the model
public class SelectModel
{
public List<String> Scripts { get; set; }
public string ScriptSelection { get; set; }
public IFormFile InputFile { get; set; }
}
and here's where I'm trying to populate the list in the controller
public IActionResult Index()
{
SelectModel model = new SelectModel();
model.Scripts.Add("Germany");
return View(model);
}
I'm getting null ref exception at model.Scripts.Add("Germany");
I've populated a model from a view and passed it back to a controller before but I seem to be having issues initialising the model in the controller for my 1st view