Fork me on GitHub
2sxc 9.0 for DNN 7 to 9
Website Builder, Content Manager, App-System: free and amazing - done your way
You are here: Home  >  Docs  >  Feature

Partial Views for Re-Using Razor Templates @RenderPage

Introduced in Version 06.00.00
Demos of this feature

So you can create various razor-views like...

  1. List
  2. Details
  3. Filtered list

and use these as sub-templates for another script. This is especially practical if you want to re-use parts of templates.

How does it work? Here's an example how a main script could change Razor-Views based on a URL-Parameter 

@if (Request.QueryString["feature"] == null)

{

       @RenderPage("_2SexyContent Feature - List.cshtml");

}

else

{

       @RenderPage("_2SexyContent Feature - Details.cshtml", Request.QueryString["Feature"]);

}

 

This could be used as follows

  1. You could create single-page Apps, where the other views are on the same page
  2. The main Content-Element of this module could have configuration-parameters, and this Content always be available in the sub-pages. You could still do things like @Content.Title
  3. You could also create apps which show the same data, but just vary the template
  4. You can re-use partial templates (for example a sub-template showing just one person, which is used at the bottom of a blog-app)

Try the View Management Demo App to discover it or read more in my blog post about this.

Tags for this feature

2serve . 2invent . 2create is 2be.