I have 2 methods (get and post) for view. In post method I call a get method again (because data invalid), but when I see view page again I see with pre-populated data. Why?
public ActionResult FillForm(string FormID)
{
FillRecordViewModel model = new FillRecordViewModel();
model.RefHost = host;
model.FormID = FormID;
model.Country = new SelectListModel();
model.Country.Values = (from i in db.Countries select new SelectListItem() { Text = i.CountryName, Value = i.CountryID.ToString() }).ToList();
return View(model);
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult FillForm(FillRecordViewModel model)
{
if (ModelState.IsValid)
{
}
else
{
return FillForm(model.FormID);
}
}