ASP.MVC - ViewData

Is ViewData MVC equivalent to ViewState web forms?

+6
asp.net-mvc webforms
source share
4 answers

No ViewData is a set of information that is used by views in ASP.NET MVC. This is a way of transferring additional data to a view that is larger than the Model for the view. ViewData is not sent to the client; it is used by the server when processing output to send to the client.

ViewFate in WebForms is a way to maintain state between postbacks. ViewState is sent between the client and server.

+5
source share

The viewing state is saved on the client and sent back to the server with each request. It is used to add a status form to your web application.

ViewData is not saved or sent to the client and is used by the server for processing. You can use it to send additional information in your opinion from the controller.

+2
source share

Not really, since the ViewState is stored in the form field, but the ViewData is not. So, if you put something in the ViewData when the page is requested, then expect your controller to be able to return it when the form is placed on this page, it will not be there. With ViewState it will be.

0
source share

Not really - mvc has no analogues in theory, but they have some common features in use. Could you clarify what your question really is?

0
source share

All Articles