TempData and ViewBag are designed to pass data from the controller to the View. It is not possible to update TempData or ViewBag without making a trip to the server.
Is there any way to change a variable in the View without reloading the page?
I'm sure there is a way to solve the current programming problem if you explain the use case and share code that illustrates the issue.