My Index.cshtml
@model ReportGenerator.WebUI.Models.ReportViewModel
@Html.TextBoxFor(m => m.report.FileName, new { @class = "form-control", id = "FileName" })
My controller
public ActionResult Index(ReportViewModel model)
{
...some stuff
model.report = new Report();
model.report.FileName = "INDEX";
return View(model);
}
public ActionResult fillFields(ReportViewModel _model)
{
...some stuff
_model.report = new Report();
_model.report.FileName = "FILL";
return View("Index", _model);
}
When I run my application the TextBox
Text
property is set to "INDEX". Also when I click on a button which calls the fillFields
controller action, the TextBox
is still displaying "INDEX", it's not changing to "FILL".
What am I doing wrong? Why it doesn't want to work?