1 solution

Solution 1

You can use Model,ViewData,ViewBag,TempData for send data to view. I prefer ViewData for your requirement as its type is dynamic. In your code you used ViewBag and though is not working, you commented out ViewBag.
Actually it will work when you use View(YourViewName) method for return ActionResult. If you use RedirectToAction method then it actually use 2 separate request so ViewData/ViewBag value will be lost. If you still need to use ReDirectToAction then you should send data to view with the help of TempData object.