0
votes

In google chrome when coming back to saved page its empty but in mozilla when return back to same form then showing saved data in controls as it is. So how to clear the form controls after submit the data?

ModelState.Clear();

but its not working. And also put below code in saving form.

window.onbeforeunload = function() { return "You work will be lost."; };

its clearing the fields when return back to saving page but when we clicking the save button then throwing alert.

so how to save without ask 'Leave this page' option and work clearing the fields after save the page?

1
User jquery $(#this).Clear()Coding Freak
where to write this code?Dawood Abbas

1 Answers

0
votes

Try doing this

Instead of return View()

use return RedirectToAction("Index")

[HttpGet]
public ActionResult Index()
{
           return View();
}
[HttpPost]
public ActionResult Index()
{
          //Your Code//
      //model.SaveChanges();
      return RedirectToAction("Index");       
}