Click here to Skip to main content
16,012,223 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how return razor code for layout of view instead of master page name
for example instead of

C#
return View("Index", "_Layout");


use this code



C#
 return View("Index", @"

@using System.Diagnostics
@using iaumahallat.Helper
<!DOCTYPE html>
<html lang="en">
<head>
    <title>@ViewBag.SiteTitle - @ViewBag.Title</title>
    <meta name="description" content="@ViewBag.MetaDescription">

    @Scripts.Render("~/bundles/modernizr")

</head>
<body>

           @RenderBody()

  @RenderSection("scripts", required: false)



</body>
</html>


");
Posted
Comments
[no name] 4-May-14 0:46am    
Any reason for doing this while you can do that using a separate view and simply add that name into the return view?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900