我可以在同一个项目中使用Mvc和普通Asp.Net吗? [英] Can I Use Mvc And Normal Asp.Net Both In The Same Project?

查看:75
本文介绍了我可以在同一个项目中使用Mvc和普通Asp.Net吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在拥有一个传统的asp.net项目。这是3层asp.net架构。

现在我们正在为少数现有页面改变设计(新设计)。我可以使用telerik控件在mvc中开发这些页面。点网中是否允许在同一个项目中拥有少量mvc页面和少量普通页面。请解释一下。



如果这是不可能的,这是设计页面的最佳方式.. telerik控件或ajax控件或其他任何东西?

We are having a legacy asp.net project. which is 3 tier asp.net architecture.
Now we are changing the design (new design) for few existing pages.can i develop this pages in mvc using telerik control. Is this allowed in dot net to have few mvc pages and few normal pages in the same project. Please explain Me.

And if this is not possible, which is best way to design page .. telerik controls or ajax controls or any thing else?

推荐答案

请参阅Hanselman的博客 - 将ASP.NET MVC 3集成到现有升级的ASP中。 NET 4 Web窗体应用程序 [ ^ ]和插件混合:ASP.NET WebForms和ASP.MVC以及ASP.NET动态数据并排 [< a href =http://www.hanselman.com/blog/PlugInHybridsASPNETWebFormsAndASPMVCAndASPNETDynamicDataSideBySide.aspxtarget =_ blanktitle =New Window> ^ ]。
See Hanselman's Blog - Integrating ASP.NET MVC 3 into existing upgraded ASP.NET 4 Web Forms applications[^] and Plug-In Hybrids: ASP.NET WebForms and ASP.MVC and ASP.NET Dynamic Data Side By Side[^].


因为ASP.NET MVC是ASP.NET框架的一部分,几乎所有ASP.NET命名空间,类和接口都可以在MVC应用程序中使用,



ASP.NET MVC不维护通过使用视图状态来状态信息,如果需要,您必须找到管理状态信息的其他方法。此外,依赖于视图状态和回发的服务器控件将无法按照ASP.NET MVC应用程序的设计工作。



因此,您不应使用诸如GridView,Repeater和DataList控件

Web窗体页面的生命周期很复杂,在此期间会发生许多事件。 ASP.NET MVC应用程序不支持这些事件,因为模型,视图和控制器之间的交互使用不同的生命周期模型
Because ASP.NET MVC is part of the ASP.NET framework, almost all ASP.NET namespaces, class, and interfaces can be used in MVC applications,

ASP.NET MVC does not maintain state information by using view state, you must find other ways to manage state information, if you need it. In addition, server controls that rely on view state and postback will not work as designed in an ASP.NET MVC application.

Therefore, you should not use controls such as the GridView, Repeater, and DataList controls
The life cycle of a Web Forms page is complex, during which many events occur. These events are not supported in an ASP.NET MVC application, because the interactions between the model, view, and controller use a different life-cycle model


这篇关于我可以在同一个项目中使用Mvc和普通Asp.Net吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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