Miki Shah
Miki Shah

Reputation: 815

ASP.Net MVC with Razor and ASPX view engine both in one project

Can we use both Razor and ASPX view engine in one asp.net mvc project?

For example, Controller1 will use cshtml page Controller2 will use aspx view.

or can we change viewengine type dynamically?

Upvotes: 4

Views: 5954

Answers (2)

Snehal Thakkar
Snehal Thakkar

Reputation: 93

i built my application on razor view so my default view file is Index.cshtml.. instead of that i use LIST.aspx view and this is how you cold do. it is easy just specify as below

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. 
}

let me know if you have an error or anything

Upvotes: 0

mitchimus
mitchimus

Reputation: 828

I believe this ASP.NET MVC Blog Post should give you what you're after.

Upvotes: 6

Related Questions