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 System.Object, mscorlib
<!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 | |
---|---|---|---|---|---|
Attributes | Dictionary<String,Object> |
attribute
static value
|
null | ||
ClientIDMode | ClientIDMode | Gets or sets the client ID generation algorithm. |
attribute
static value
|
Static | |
DataContext | Object | Gets or sets a data context for the control and its children. All value and command bindings are evaluated in context of this value. |
attribute
static value
bindable
|
null | |
ID | String | Gets or sets the unique control ID. |
attribute
static value
bindable
|
null | |
IncludeInPage | Boolean | Gets or sets whether the control is included in the DOM of the page. |
attribute
bindable
|
True | |
InnerText | String | Gets or sets the inner text of the HTML element. |
attribute
static value
bindable
|
null | |
RenderWrapperTag | Boolean | Gets or sets whether the control should render a wrapper element. |
attribute
static value
|
False | |
Visible | Boolean | Gets or sets whether the control is visible. |
attribute
bindable
|
True | |
WrapperTagName | String | Gets or sets the name of the tag that wraps the Repeater. |
attribute
static value
|
div |