没有视图状态或回传的ASP MVC? [英] No viewstate or postback in ASP MVC?

查看:117
本文介绍了没有视图状态或回传的ASP MVC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在学习MVC了一段时间,我想我pretty多了解它的全部。但有一件事我还不明白:我跟上MVC听到没有视图状态也不回发。

I've been learning about MVC for a while, and I think I pretty much understand what it's all about. But there is one thing I don't yet understand: I keep hearing with MVC that there is no viewstate nor postback.

谁能解释这是什么意思简单来说?

Can someone explain what this means in simple terms?

推荐答案

<一个href=\"http://stackoverflow.com/questions/366151/asp-net-mvc-doesnt-work-with-viewstate-and-postback\">Try该SO回答既解决了同样的问题。

评论/问题后,额外的信息:

Extra info after comment/question:

ASP.Net Web窗体可以使用ViewState的服务器控件的状态存储在页面上以及管理的服务器端事件的调用,如点击一个按钮。我们的想法是present的编程模型类似于赢窗体的方法来使它更容易为Win窗体开发转型和淘汰基于浏览器的应用程序。要了解它的深度,你应该打谷歌和了解asp.net页面生命周期,这将解释整个过程并说明从哪里ViewState的处理符合。的这里的pretty很好的解释

ASP.Net web forms can use viewstate to store the state of server controls on the page and to manage invocation of server side events such as a button click. The idea is to present a programming model that is similar to the Win Forms approach to make it easier for Win Forms developers to transition and knock out browser based apps. To learn about it in depth you should hit google and learn about the asp.net page life cycle which will explain the overall process and explains where viewstate processing fits in. Here's a pretty good explanation.

ASP.Net MVC是使用不同的视图引擎来生成的标记不同的编程模型 - 即实际流回到你的浏览器客户端的内容。在一定程度上它消除了很多的网络形式推出了神奇,但作为回报,你能产生更多的标准标记,并有超过究竟会呈现给客户更大的控制权。如果你正在学习MVC看看在NerdDinner范例样章这是一个很好的教程以及MVC的音乐商店。纵观这些都是很好的片头做MVC。

ASP.Net MVC is a different programming model that uses different view engines to generate your markup - i.e. the content that actually streams back to your browser client. To an extent it removes a lot of the "magic" that web forms introduced but in return you can produce more standard markup and have greater control over what will be rendered to the client. If you're learning MVC take a look at the NerdDinner sample chapter which is a good tutorial as well as the MVC Music Store. Throughout those are good intros to doing MVC.

MVC不使用/需要的ViewState或回传,因为它是一个不同的编程模型。哪一个更好/更适合于任何项目是一个很大的争论,我将让别人因为我觉得双方都有自己的优势和可以在不同的情况下非常有用(虽然我个人主要使用MVC现在......)。你说的没错,事情正在做不同...你不能只是简单的事件驱动的方式工作的网络形式模仿但MVC有很多它自己的优势,你会穿过无数的博客文章比较的WebForms VS发现MVC。

MVC doesn't use/need viewstate or postbacks as it's a different programming model. Which is better/more appropriate for any given project is a big debate that I'll let others have as I think both have their strengths and can be useful in different scenarios (although I personally mainly use MVC now...). You're right that things are done differently... you can't just work with the simple event driven approach that web forms imitates but then MVC has lots of strengths of its own which you'll find across countless blog posts comparing webforms vs MVC.

这篇关于没有视图状态或回传的ASP MVC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆