DOT

VVM

 DOCS

Version: 1.0 | 1.1 |

SpaContentPlaceHolder

in namespace DotVVM.Framework.Controls

Container which can host a single page application.

Properties

Name Type Description Notes Default Value
Attributes Dictionary<String,Object>
attribute
inner element
static value
bindable
default
ClientIDMode ClientIDMode Gets or sets the client ID generation algorithm.
attribute
inner element
static value
bindable
default
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
inner element
static value
bindable
default
DefaultRouteName String Gets or sets the default name of the route that should be loaded when there is no hash part in the URL.
attribute
inner element
static value
bindable
default
ID String Gets or sets the unique control ID.
attribute
inner element
static value
bindable
default
InnerText String Gets or sets the inner text of the HTML element.
attribute
inner element
static value
bindable
default
PrefixRouteName String Gets or sets the name of the route defining the base URL of the SPA (the part of the URL before the hash). If this property is not set, the URL of the first page using the SpaContentPlaceHolder will stay before the hash mark.
attribute
inner element
static value
bindable
default
RenderWrapperTag Boolean Gets or sets whether the control should render a wrapper element.
attribute
inner element
static value
bindable
default
False
Visible Boolean Gets or sets whether the control is visible.
attribute
inner element
static value
bindable
default
True
WrapperTagName String Gets or sets the name of the tag that wraps the Repeater.
attribute
inner element
static value
bindable
default
div

Events

Name Type Description

Usage & Scenarios

Container which can host a single page application.

To get better understanding how SPAs work, look at the SPA tutorial.

HTML Rendered by the Control

Sample 1: Simple SPA

A simple example of the SPA.

@viewModel DotvvmWeb.Views.Docs.Controls.builtin.SpaContentPlaceHolder.sample1.BaseViewModel, DotvvmWeb
<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
	
     <menu>
        <li>
          <dot:RouteLink RouteName="SampleA" Text="TextBox sample" />
        </li>
        <li>
          <dot:RouteLink RouteName="SampleB" Text="Literal sample" />
        </li>
    </menu>

    <dot:SpaContentPlaceHolder ID="Sample" DefaultRouteName="SampleA" />

</body>
</html>
@viewModel DotvvmWeb.Views.Docs.Controls.builtin.SpaContentPlaceHolder.sample1.ViewModelA, DotvvmWeb
@masterPage master.dotmaster

<dot:Content ContentPlaceHolderID="Sample">
  <dot:TextBox Text="{value: FirstName}" />
</dot:Content>
@viewModel DotvvmWeb.Views.Docs.Controls.builtin.SpaContentPlaceHolder.sample1.ViewModelB, DotvvmWeb
@masterPage master.dotmaster

<dot:Content ContentPlaceHolderID="Sample">
  {{value: Text}}
</dot:Content>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DotVVM.Framework.Configuration;

namespace DotvvmWeb.Views.Docs.Controls.builtin.SpaContentPlaceHolder.sample1
{
    public class Startup : IDotvvmStartup
    {
        public void Configure(DotvvmConfiguration config, string applicationPath)
        {
            config.RouteTable.Add("SampleA", "SampleA", "SampleA.dothtml", null);
            config.RouteTable.Add("SampleB", "SampleB/{Id}", "SampleB.dothtml", null);
        }
    }
}
using DotVVM.Framework.ViewModel;

namespace DotvvmWeb.Views.Docs.Controls.builtin.SpaContentPlaceHolder.sample1
{
    public class ViewModelA : BaseViewModel
    {

        public string FirstName { get; set; } = "Tomas";

    }
}
using DotVVM.Framework.ViewModel;

namespace DotvvmWeb.Views.Docs.Controls.builtin.SpaContentPlaceHolder.sample1
{
    public class ViewModelB : BaseViewModel
    {

        public string Text { get; set; } = "Test value";

    }
}
using DotVVM.Framework.ViewModel;

namespace DotvvmWeb.Views.Docs.Controls.builtin.SpaContentPlaceHolder.sample1
{
    public abstract class BaseViewModel : DotvvmViewModelBase
    {
        
    }
}

Suggestions


Help & Contribute

The documentation is maintained on GitHub.
We'll be happy if you edit the page and create a pull request.

Send message