开发者

In ASP.NET MVC, Data exchange between Model and View is possible?

开发者 https://www.devze.com 2023-02-20 04:16 出处:网络
Is there a option to pass data between Model and view in ASP.NET. If it can be accomplished ho开发者_Go百科w? This was asked in an interview !!! Yes... well, the view is either typed, which means the

Is there a option to pass data between Model and view in ASP.NET. If it can be accomplished ho开发者_Go百科w? This was asked in an interview !!!


Yes... well, the view is either typed, which means the object that represents the model is directly accessible, or the controller returns a ViewBag with data or anything else the view needs to render. That's the whole point of the model-view part of the pattern.


The whole point of MVC is that the data(Model) should be shown to user (View) by use of Controller. Even if the view is typed, your still need the model to bind to it. Even to create a ViewBag, you need the controller action to fill it...

0

精彩评论

暂无评论...
验证码 换一张
取 消