I have a Partial View and fill my TempData with this code block. serviceResponsecont is a list.
TempData["partialResponseList"] = serviceResponseCont;
After this from the PartialView I call the same controller and try to get same data like this.
serviceResponseCont = TempData["partialResponseList"] as List<CadetTest.Controllers.HomeController.cont>;
But it returns me null in second post. I have to carry this list but tempdata didn't help in this way. How can I fix it or is there any solution for this?
TempData is used to store the temporary data
TempData itself cannot be used to send data from View to Controller
TempData is also used for transferring Models/Controllers data to views and other actions/Controllers
There are other ways to transfer Tempdata from view to control
Example
Example3 ExampleWithJquery