I have a drop down list control on a partial view and after posting the form the state of the drop down list control is not maintained
Here is the partial view cshtml co
combined.testCriteria.Year needs to get set with the form value you posted
Try this
[HttpPost]
public ActionResult Results(TestCriteriaConsolidated form)
{
List test = new List();
test.Add(new TestCriteriaResults { Value1 = "one", Value2 = "one", Value3 = "three", Value4 = "Four" });
test.Add(new TestCriteriaResults { Value1 = "one", Value2 = "two", Value3 = "three", Value4 = "four" });
test.Add(new TestCriteriaResults { Value1 = "one", Value2 = "two", Value3 = "three", Value4 = "four" });
test.Add(new TestCriteriaResults { Value1 = "one", Value2 = "two", Value3 = "three", Value4 = "four" });
test.Add(new TestCriteriaResults { Value1 = "one", Value2 = "two", Value3 = "three", Value4 = "four" });
TestCriteria criteria = new TestCriteria() { Year = form.testCriteria.Year };
TestCriteriaConsolidated combined = new TestCriteriaConsolidated
{
testCriteriaResults = test,
testCriteria = criteria
};
return View(combined);
}
public ActionResult Results()
{
return View(new TestCriteriaConsolidated());
}