I have a controller with a method which returns a partial view and generates ViewData. Then, I have some methods, each of them returns Json objects and ViewData. But, the ViewData is not getting refreshed. How to refresh it? Is this possible?
public ActionResult FirstMethod() {
ViewData["someList"] = ...;
return PartialView(someOtherList);
}
public JsonResult SomeMethod()
{
ViewData["someNewList"] = ...;
return new JsonResult { ... };
}
But, although SomeMethod() is called after FirstMethod(), the ViewData which I use in my view is someList.