Asp.Net MVC - Blank model not returning blank data
- by Pino
I have a form which a user can fill in x times with the data they want too. The form is posted to the following Action.
        [HttpPost]
        public ActionResult Manage(ProductOptionModel DataToAdd)
        {
            if (!ModelState.IsValid)
            {
                return View(DataToAdd);
            }
            var ProdServ = new ProductService();
            if (DataToAdd.ID != 0)
            {
                //Edit Mode.
                DataToAdd = ProdServ.EditProductOption(DataToAdd);
                ViewData["Message"] = "Option Changes Made";
            }else
            {
                //Add
                DataToAdd = ProdServ.AddProductOption(DataToAdd);
                ViewData["Message"] = "New Option Added";
            }
            var RetModel = new ProductOptionModel() {ProductID = DataToAdd.ProductID};
            return View(RetModel);
        }
So at the bottom I blank the model (Leaving just the required field) and then return to the view. However the view holds the data from the previously submitted form.
Any ideas why? I have debugged the code and checked that the RetModel variable is empty.