Table of Contents

Class PageViewModel

Namespace
Dynamicweb.Frontend
Assembly
Dynamicweb.dll

PageViewModel represents the rendering context used when a page is rendered. All properties are eager-loaded.

public class PageViewModel : ViewModelBase
Inheritance
PageViewModel
Inherited Members

Properties

Area

Gets the area associated with the page. Area is the technical term for a website in the application.

public AreaViewModel Area { get; set; }

Property Value

AreaViewModel

The area viewmodel or null.

Cart

Gets the current cart. Can be used for e.g. minicart in layout template.

public CartViewModel Cart { get; set; }

Property Value

CartViewModel

The current cart-viewmodel if the user has added products to their cart, otherwise an empty instance.

Content

Gets the content as a dictionary of content placeholder ids (key) and its content html (the value).

public IDictionary<string, string> Content { get; set; }

Property Value

IDictionary<string, string>

The content as a IDictionary(Of String, String) where key is the placeholder id and value is the markup of the content placeholder.

Remarks

Usually not used in template, but handled by @ContentPlaceholder() in layout template.

CreatedDate

The precise timestamp for when this page was created in the database.

public DateTime CreatedDate { get; set; }

Property Value

DateTime
See Also

CurrentSecondaryUser

Gets the current secondary user.

public UserViewModel CurrentSecondaryUser { get; set; }

Property Value

UserViewModel

The current secondary user user-viewmodel.

CurrentUser

Gets the current user. If no user is logged in an empty UserViewModel is assigned to the property. Secondary users are users which a user can impersonate, see also HasSecondaryUsers and SecondaryUsers.

public UserViewModel CurrentUser { get; set; }

Property Value

UserViewModel

The current user user-viewmodel.

Description

Gets the description based on the MetaTags on the PageView.

public string Description { get; set; }

Property Value

string

The description of the page viewmodel, e.g. "this is a page viewmodel".

GridContent

Gets the grid content as a dictionary of gridconent placeholder ids (key) and its content html (the value).

public IDictionary<string, string> GridContent { get; }

Property Value

IDictionary<string, string>

The content as a IDictionary<string,string> where the key is the placeholder id and the value is the markup of the content placeholder

Remarks

Usually not used in template, but handled by @Model.Grid() in layout template.

HasSecondaryUsers

Returns true if the logged-in user can impersonate other users.

public bool HasSecondaryUsers { get; }

Property Value

bool

True if any secondary users exists, otherwise false.

See Also

ID

The id of the page.

public int ID { get; set; }

Property Value

int
See Also

IsCurrentUserAllowed

Checks if the current user, anonymous or not, has access to this page based on their [permissions] (xref:manual-permissions). If they don't, GetLogonDialog() is set.

public bool IsCurrentUserAllowed { get; }

Property Value

bool

E.g. True if the user has access

Item

If this page has an item associated with it, this property gives you access to the item viewmodel which is used to access item content.

public ItemViewModel Item { get; set; }

Property Value

ItemViewModel

The Item-viewmodel or null.

ItemId

See ItemId

public string ItemId { get; set; }

Property Value

string

ItemType

See ItemType.

public string ItemType { get; set; }

Property Value

string

Keywords

Gets the keywords. Arises from the MetaTags on the PageView as the dictionary-value associated with key "Keywords".

public string Keywords { get; set; }

Property Value

string

The keywords e.g. any string such as keyword.

Languages

Gets a list of language versions of this page.

public IList<PageLanguageViewModel> Languages { get; set; }

Property Value

IList<PageLanguageViewModel>

The languages i.e a PageLanguageViewModel.

LogOnFailed

See Success.

public bool LogOnFailed { get; set; }

Property Value

bool

Negates the value of Success.

LogOnFailedReason

public LogOnFailedReason LogOnFailedReason { get; set; }

Property Value

LogOnFailedReason

MetaTags

Gets the meta tags associated with Meta.

public string MetaTags { get; }

Property Value

string

The meta tags markup including canonical.

Remarks

The output is build using Output().

Name

Gets the name of the page, usually used for navigation purposes.

public string Name { get; set; }

Property Value

string
See Also

Path

Gets the path to this page.

public IList<PageReferenceViewModel> Path { get; set; }

Property Value

IList<PageReferenceViewModel>

The path as PageReferenceViewModel from root to this page.

Remarks

Can be used for breadcrumbs as an alternative to NavigationTreeViewModel

PropertyItem

If this page has a item type extending the default page settings associated with it,
this property gives you access to the item viewmodel which is used to access values from those settings.

public ItemViewModel PropertyItem { get; set; }

Property Value

ItemViewModel

The property item or null.

PropertyItemId

public string PropertyItemId { get; set; }

Property Value

string

PropertyItemType

See Area property ItemTypePageProperty.

public string PropertyItemType { get; set; }

Property Value

string

SecondaryUsers

Gets a list of users that the current user can impersonate, see also HasSecondaryUsers and CurrentSecondaryUser.

public IList<UserViewModel> SecondaryUsers { get; set; }

Property Value

IList<UserViewModel>

The secondary users.

Remarks

Has a potential performance hit.

ShowUpdatedDate

public bool ShowUpdatedDate { get; set; }

Property Value

bool

Title

Gets the page meta title.

public string Title { get; set; }

Property Value

string
See Also

TopPage

Gets the top page. Returns the top page in the page path where this page is located.

public PageReferenceViewModel TopPage { get; set; }

Property Value

PageReferenceViewModel

The top page.

UpdatedDate

Gets the date for when this page was last updated.

public DateTime UpdatedDate { get; set; }

Property Value

DateTime

The updated date.

See Also

Methods

GetColorSchemeStyle()

Gets the link to the css file with the area's color scheme group.

public string GetColorSchemeStyle()

Returns

string

E.g. /Files/System/ColorSchemes/SwiftStyle.css

GetCookieWarningContent()

Gets the cookie banner as defined in cookiemanager settings.

public string GetCookieWarningContent()

Returns

string

Remarks

The returned value is the markup coming from the cookie banner template.

GetLogonDialog()

Gets the content of LogonDialog.

public string GetLogonDialog()

Returns

string

Grid(string, string, string, string)

Returns the grid content.

public string Grid(string placeholderId, string name, string settings, string gridTypeId)

Parameters

placeholderId string

Content id

name string

Not in use.

settings string

Not in use.

gridTypeId string

Not in use.

Returns

string

Value of GridContent if the id has a match. The return value is markup

See Also

Placeholder(string)

Used to define a placeholder in a layout template. Does not return anything.

public string Placeholder(string id)

Parameters

id string

The id of the container.

Returns

string

A string containing html pertaining to that specific content id.

Placeholder(string, string)

Used to define a placeholder in a layout template. Does not return anything.

public string Placeholder(string id, string title)

Parameters

id string

The id of the container.

title string

The title of the container.

Returns

string

A string containing html pertaining to that specific content id.

Remarks

title is not in use.

Placeholder(string, string, string)

Used to define a placeholder in a layout template. Does not return anything.

public string Placeholder(string id, string title, string settings)

Parameters

id string

The id of the container.

title string

The title of the container.

settings string

The settings for the container specified as a string of values separated by semicolon, e.g. "default:true;sort:1"

Returns

string

A string containing html pertaining to that specific content id.

Remarks

Title and settings is no more in use.

See Also

To top