16

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

2
  • Check the link given below if that helps you : > codeproject.com/Articles/476967/… Commented May 13, 2014 at 5:18
  • 1
    By the way, I think you have misconception about the viewstate. ..viewstate doesn't persist data in the application, it just maintain the page status between requests Commented May 13, 2014 at 5:47

2 Answers 2

17

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 .

Sign up to request clarification or add additional context in comments.

Comments

0

The MVC tries to apply the concept of Http protocol statelessness!! So there should be no viewstate equivalent to that of the asp web forms.

However in single page application, aka SPA : you use java script library on client to manage the page and contact the server using Ajax! So it gives the impression. That the viewstate is maintained

3 Comments

What is the model's role during postback events?
what do you mean by The MVC tries to apply the concept of Http protocol statelessness can you explain?
Try to have an idea herehttp://stackoverflow.com/questions/4913763/what-does-it-mean-when-they-say-http-is-stateless

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.