return RedirectToAction("ActionName", new { lst = finalData });
[HttpGet]
Public ActionResult AcionName(IGrouping<string, ModelName> lst)
{
return View("ActionName", lst);
}
i use this code to redirect my list to another action but this is not working.
You can assign the
finalData
to aSession
orTempData
variable.From this answer: "
TempData
Allows you to store data that will survive for a redirect. Internally it uses the Session, it's just that after the redirect is made the data is automatically evicted"Then in your
GET
Action Method,The problem is, if you were to refresh after the redirect, then
finalData
would be null. So, in that case you useSession["FinalData"]
or get the data from the Database in your Get method again. You can go through the answer I have linked for disadvantages of usingTempData
.