开发者

What is the difference between ascx and .cshtml?

开发者 https://www.devze.com 2023-04-03 23:23 出处:网络
I have this in my index.cshtml: @{ ViewBag.Title = \"Home Page\"; } @{ Html.RenderPartial(\"~/Views/Home/Test.cshtml\");

I have this in my index.cshtml:

@{
    ViewBag.Title = "Home Page";
}

@{
    Html.RenderPartial("~/Views/Home/Test.cshtml");
}

and this in my controller:

 [ChildActionOnly]
        public ActionResult Test()
        {
            return View();
        }

I am not able to understand what is the fundamental difference between using .ascx and .cshtml in RenderPartial method? Both works for me. What is the real difference? Can 开发者_C百科anybody explain?


There are two different view engines you can use for asp.net mvc3 web applications. Razor (.cshtml) and ASPX (*.aspx / *.ascx).

Take a look at this post about their differences:

What is the difference between Razor and ASPX?

0

精彩评论

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