What is the equivalent of viewstate in ASP.net MVC

RandomUser picture RandomUser · May 13, 2014 · Viewed 53.7k times · Source

In asp.net pages, during postback, ViewState makes the data persistent. What makes the data persistent in ASP.net MVC?

Answer

Ajay picture Ajay · May 13, 2014

In Asp.Net we have Runat="Server" to make controls like Textbox,Checkbox... into asp.net controls which they run at server and they can maintain viewstate because of they are server controls.

Http is Stateless:

Http is stateless i.e; for it forgets the controls value (like Textbox,Checkbox) for every request that means it doesnt maintain state.To make stateful we use state management techniques like ViewState,Querystring,Sessions,Cookies in Asp.Net.

Coming to your Question

In MVC we dont have Viewstate.In order to maintain the values refer below link

Maintaining viewstate in Asp.net mvc?

ASP.NET MVC doesn't work with ViewState and Postback?

we use ViewBag,ViewData,TempData for the flow of values from controller to view or controller to controller .