How will the data gets passed between controller and views?

 Posted by Kmandapalli on 1/20/2014 | Category: ASP.NET MVC Interview questions | Views: 2814 | Points: 40
Answer:

The controller gets the first hit and loads the model. Most of the time we would like to pass the model to the view for displaying data and so we use session variables, viewstate and so on. But the problem with using sessions or view state object is the scope. ASP.NET sessions have session scope and the view state have page scope. In MVC, we would like the data to be maintained when the hit comes to the controller and reaches the view and after that the scope of the data should expire.

That’s where the new session management technique has been introduced in the ASP.NET MVC framework, i.e., ViewData.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Shadyyehia on: 5/21/2015 | Points: 10
answer is not enough and complex.

answer is : ViewData , ViewBag and Session.

Login to post response