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
- Extension Methods
Properties
Area
Gets the area associated with the page. Area is the technical term for a website in the application.
public required AreaViewModel Area { get; set; }
Property Value
- AreaViewModel
The AreaViewModel or null.
Cart
Gets the current cart. Can be used for e.g. mini-cart in layout template.
public CartViewModel Cart { get; set; }
Property Value
- CartViewModel
The current CartViewModel if the user has added products to their cart, otherwise an empty instance.
ColorScheme
Gets or sets the color scheme.
public ColorSchemeViewModel? ColorScheme { get; set; }
Property Value
- ColorSchemeViewModel
The color scheme as an ColorSchemeViewModel.
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
- See Also
CurrentSecondaryUser
Gets the current secondary user.
public UserViewModel? CurrentSecondaryUser { get; set; }
Property Value
- UserViewModel
The current secondary user UserViewModel.
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 UserViewModel.
Description
Gets the description based on the Dynamicweb.Frontend.Meta.MetaTags on the PageView.
public string? Description { get; set; }
Property Value
- string
The pages meta description.
GridContent
Gets the grid content as a dictionary of grid-content 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
Trueif any secondary users exists, otherwisefalse.
- See Also
ID
The id of the page.
public int ID { get; set; }
Property Value
- 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.
Trueif the user has access
Item
If this page has an item associated with it, this property gives you access to the ItemViewModel which is used to access item content.
public ItemViewModel? Item { get; set; }
Property Value
- ItemViewModel
An ItemViewModel instance or null.
Keywords
Gets the keywords. Arises from the Dynamicweb.Frontend.Meta.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.
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 Dynamicweb.Frontend.Meta.Output().
Name
Gets the name of the page, usually used for navigation purposes.
public string? Name { get; set; }
Property Value
- 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.
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.
Title
Gets the page meta title.
public string? Title { get; set; }
Property Value
- 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
GetCookieWarningContent()
Gets the cookie banner as defined in cookiemanager settings.
public string? GetCookieWarningContent()
Returns
Remarks
The returned value is the markup coming from the cookie banner template.
Grid(string, string, string, string)
Returns the grid content.
public string Grid(string placeholderId, string name, string settings, string gridTypeId)
Parameters
placeholderIdstringContent id
namestringNot in use.
settingsstringNot in use.
gridTypeIdstringNot 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
idstringThe 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
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
idstringThe id of the container.
titlestringThe title of the container.
settingsstringThe 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.
SetCartViewModelFactory(Func<CartViewModel>)
public void SetCartViewModelFactory(Func<CartViewModel> cartViewModelFactory)
Parameters
cartViewModelFactoryFunc<CartViewModel>