i am using a viewbag to show a drop down in view .. now when my post method is complete it returns back to view which then throws exception for dropdown because my view bag has nothing after that .
[HttpGet]
public ActionResult Add(string id)
{
List<req> objlist = new List<req>();
objlist = Getlist(Id);
ViewBag.List = objlist;
TempData["tempList"] = ViewBag.List;
return View();
}
Above is my Get method and for POST method can i do this
[HttpPost]
public ActionResult Add()
{
ViewBag.List = TempData["tempList"];
return View();
}
All this because i dont want Run the SQL Call again .