Provide partial in web pages without using MVC

I use Razor with web pages, but without MVC. I like the simplicity with this, so I'm not interested in using MVC at this point. However, I would like to make a partial part of my page. Like menu, footer, etc.

Using MVC you can: @ {Html.RenderPartial ("Footer", model);}

I would like to do something like this: @ {Html.RenderPartial ("footer.cshtml"); }

How can I achieve what I want?

+5
source share
1 answer

take a look at this link http://www.mikesdotnetting.com/Article/151/Extending-ASP.NET-Web-Pages-Create-Your-Own-Helpers

Hope this helps you

also try the following:

<!DOCTYPE html>
<html>
  <head>
    <title>Main Page</title>
  </head>
  <body>
    @RenderPage("/Shared/_Header.cshtml")
    <h1>Index Page Content</h1>
    <p>This is the content of the main page.</p>
    @RenderPage("/Shared/_Footer.cshtml")
  </body>
</html>
+7

All Articles