首页 文章

ASP.Net MVC与Razor和ASPX视图引擎都在一个项目中

提问于
浏览
2

我们可以在一个asp.net mvc项目中同时使用Razor和ASPX视图引擎吗?

例如,Controller1将使用cshtml页面,Controller2将使用aspx视图 .

或者我们可以动态更改viewengine类型吗?

2 回答

  • 5

    我相信这个ASP.NET MVC Blog Post会给你你想要的东西 .

  • 0

    我在razor视图上构建了我的应用程序,所以我的默认视图文件是Index.cshtml ..而不是我使用LIST.aspx视图,这就是你冷酷的做法 . 它很容易指定如下

    public ActionResult Index() // this is Index Action
    {
        var employees = db.Employees.Include("Department");//e => e.
        return View("LIST",employees.ToList()); // syntax this how u can use ASPX.view "LIST" is an ASPX View file in my application. 
    }
    

    如果您有任何错误,请告诉我

相关问题