ContentPlaceHolder

in namespace DotVVM.Framework.Controls

Represents a placeholder in the master page that contains the Content from the content page.

Usage & Scenarios

Represents a placeholder in the master page that contains the Content from the content page.

See Master Pages tutorial for more information.

Sample 1 : Example on Master Page

The ContentPlaceHolder has the ID property which identifies the corresponding Content in the content page.

You can specify a default content for a ContentPlaceHolder. This default content is used when there is no Content with the corresponding ID in the content page. If the Content is present in the content page, it is rendered instead of the the default content.

@viewModel object

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
    <title></title>
  </head>
  <body>

    <h1>My Awesome App</h1>
	  
    <dot:ContentPlaceHolder ID="Menu">
      <!-- This default content can be overridden in the content page. -->
	  <menu>
		<li><a href="#">Page 1</a></li>
		<li><a href="#">Page 2</a></li>
		<li><a href="#">Page 3</a></li>
		<li><a href="#">Page 4</a></li>
		<li><a href="#">Page 5</a></li>
	  </menu>
    </dot:ContentPlaceHolder>

    <dot:ContentPlaceHolder ID="Content">
      <!-- Content from page.dothtml with id Main will be placed here. -->
    </dot:ContentPlaceHolder>

  </body>
</html>
@viewModel DotvvmWeb.Views.Docs.Controls.builtin.Content.sample2.ViewModel, DotvvmWeb
@masterPage master.dotmaster

<dot:Content ContentPlaceHolderID="Content">
	<h3>Welcome! {{value: WelcomeMessage}}</h3>
	<p>Content of the page</p>
</dot:Content>

<dot:Content ContentPlaceHolderID="Menu">
	<!-- This overrides the default content from the master page. -->
	There is no menu available on this page.
</dot:Content>
using DotVVM.Framework.ViewModel;

namespace DotvvmWeb.Views.Docs.Controls.builtin.ContentPlaceHolder.sample2
{
    public class ViewModel : DotvvmViewModelBase
    {
        public string WelcomeMessage { get; set; } = "DotVVM ContentPlaceHolder sample.";
    }
}

Properties

Name Type Description Notes Default Value
property icon RenderWrapperTag Boolean Gets or sets whether the control should render a wrapper element.
attribute
inner element
static value
bindable
default
False
property icon WrapperTagName String Gets or sets the name of the tag that wraps the Repeater.
attribute
inner element
static value
bindable
default
div

HTML produced by the control