Table of Contents

Class PageView

Namespace
Dynamicweb.Frontend
Assembly
Dynamicweb.dll

The pageview object represents the current frontend pageview, the object that handles Default.aspx and all frontend page views.

public class PageView
Inheritance
PageView
Inherited Members

Remarks

Use the PageView.Current to access the instance from any code block that is run in the pageview context.

Constructors

PageView()

Initializes a new instance of the PageView class.

public PageView()

Remarks

Use Current() or PageView.GetPageviewByPageID to get an instance.

Properties

Area

Gets the Area of the current Page being rendered.

public Area Area { get; }

Property Value

Area

The area.

AreaID

The ID of the Area or website of this instance of pageview object.

public int AreaID { get; set; }

Property Value

int

AreaSettings

Gets an ItemViewModel instance of this pageviews area setting item.

public ItemViewModel AreaSettings { get; }

Property Value

ItemViewModel

Remarks

Returns null until the Load() method has been executed.

BeforeBodyEndMarkup

String in this property is inserted before the pageview is outputted - string is inserted just before the closing body tag.

public StringBuilder BeforeBodyEndMarkup { get; set; }

Property Value

StringBuilder

Remarks

Can be used to insert script tags before the body tag. If no closing body tag is available, the string is not inserted NOTE: Do not override this variable. Add your string to the current value.

CdnHostName

Gets the name of the CDN hostname from the website settings or global settings.

public string CdnHostName { get; }

Property Value

string

The name of the CDN host.

CdnHostNameForImage

Gets the name of the CDN GetImage hostname from the website settings or global settings.

public string CdnHostNameForImage { get; }

Property Value

string

The CDN host name for get image.

Context

public PageViewContext Context { get; set; }

Property Value

PageViewContext

CurrentParagraph

Gets the current paragraph being rendered.

public Paragraph CurrentParagraph { get; }

Property Value

Paragraph

Will be null if a paragraph is not being rendered.

Remarks

Should only be used from objects in the context of a paragraph. I.e. a paragraph template extender, product template extender or content module.

Device

Gets the DeviceType of the current request based on the User agent string of the browser.

public DeviceType Device { get; }

Property Value

DeviceType

Execution

Gets the ExecutionTable of the pageview. Used internally to measure time spend on renderers.

public ExecutionTable Execution { get; set; }

Property Value

ExecutionTable

Remarks

Should not be used.

ExperimentVariation

Gets the experiment variation of this pageview if the page has experiments.

public int ExperimentVariation { get; }

Property Value

int

Remarks

If page does not have experiments, 0 is returned. If original needs to be show, 1 is returned. Otherwise the ID of the variation

GlobalTags

Gets a collection of the global tags available for this pageview instance.

public TagCollection GlobalTags { get; }

Property Value

TagCollection

The global tags collection in a TagCollection.

Remarks

Used from Razor templates to get access to Global tags. Should not be used in context of a layout using the PageViewModel instance to render.

ID

Page ID of this instance of pageview object.

public int ID { get; set; }

Property Value

int

IsCurrentUserAllowed

public bool IsCurrentUserAllowed { get; }

Property Value

bool

IsCurrentUserPermissionAllowed

public bool IsCurrentUserPermissionAllowed { get; set; }

Property Value

bool

IsEmailContext

Gets or sets a value indicating whether this instance is email context.

public bool IsEmailContext { get; set; }

Property Value

bool

true if this instance is in the context of sending out an email; otherwise, false.

Remarks

Used by Email marketing to send out pages as email.

IsLocked

public bool IsLocked { get; }

Property Value

bool

IsVisualEditorMode

public bool IsVisualEditorMode { get; }

Property Value

bool

Layout

Gets the layout of this pageview.

public Layout Layout { get; }

Property Value

Layout

The layout.

Remarks

This layout template is set on the page or website properties from the administration. Not set until PageView.Load have been executed.

Meta

Gets the Meta instance of the current pageview object.

public Meta Meta { get; set; }

Property Value

Meta

Page

Gets the Page being rendered in the instance of this pageview.

public Page Page { get; }

Property Value

Page

The page.

Platform

Gets the PlatformType of the current request based on the User agent string of the browser.

public PlatformType Platform { get; }

Property Value

PlatformType

Redirect

Gets or sets a value indicating whether this PageView are allowed to do redirect.

public bool Redirect { get; set; }

Property Value

bool

true if redirects are allowed; otherwise, false.

Remarks

If this property is set to false, Dynamicweb will not redirect to i.e. search friendly url version of the same page. Use PageView.GetPageviewByPageID to get an instance that does not redirect.

SearchFriendlyUrl

Gets the search friendly URL for this instance of the pageview.

public string SearchFriendlyUrl { get; }

Property Value

string

The search friendly URL for the page currently being showed.

Remarks

The returned URL will contain any querystring information on the original url. Load() must be called before calling this.

Template

Gets the instance of the template object of the layout template.

public Template Template { get; }

Property Value

Template

Remarks

Will be null until the Load() has been called.

User

Gets the extranet user currently logged into the frontend.

public User User { get; }

Property Value

User

Remarks

If no user is logged in, null is returned

Methods

AddJavascript(string)

Adds a JavaScript path to the pages scripts section in head.

public void AddJavascript(string javascript)

Parameters

javascript string

The JavaScript path reference.

AddStylesheet(string)

Adds a stylesheet path to the pages stylesheets section in head.

public void AddStylesheet(string stylesheet)

Parameters

stylesheet string

The stylesheet path reference.

AddStylesheet(string, string)

Adds a stylesheet path to the pages stylesheets section in head for a given media.

public void AddStylesheet(string stylesheet, string media)

Parameters

stylesheet string

The stylesheet reference.

media string

The media type. One of print, screen, tv, all or other valid css media type. Default is string.empty.

Current()

Gets the PageView object of the current pageview. This can only be called in a frontend context.

public static PageView Current()

Returns

PageView

Returns null or nothing if not called from frontend or prior to Pageview.Load event has occured

Remarks

Should only be called from code executed in frontend. Use PageView.GetPageviewByPageID from backend code.

GetAreaByDomain()

Gets an instance of an area by the domain name of the current request.

public static Area GetAreaByDomain()

Returns

Area

Dynamicweb.Content.Area.

Remarks

Uses the domain and primary domain information set on website properties to find the right area

GetAreaByDomain(string)

Gets an instance of an area by the paseed domain name.

public static Area GetAreaByDomain(string domain)

Parameters

domain string

The domain, i.e. 'www.dynamicweb.com'

Returns

Area

Dynamicweb.Content.Area.

Remarks

Uses the domain and primary domain information set on website properties to find the right area

GetAreasByDomain()

Gets areas by the domain name of the current request.

public static IEnumerable<Area> GetAreasByDomain()

Returns

IEnumerable<Area>

Dynamicweb.Content.Area.

Remarks

Uses the domain and primary domain information set on website properties to find the right area

GetContent()

Gets a collection of content for this pageview for each placeholder in the layout.

public ContentCollection GetContent()

Returns

ContentCollection

System.Collections.Generic.IDictionary(Of System.String, System.String). The collection contains a key (the id of the placeholder) and the resulting html of the rendered paragraphs in a content placeholder including module output.

GetFeedContent()

Gets a feed string coming from the content section of the pageview.

public OutputResult GetFeedContent()

Returns

OutputResult

A json string

GetPageViewModelOutput()

public OutputResult GetPageViewModelOutput()

Returns

OutputResult

GetPageviewAsTemplate(int, Dictionary<string, object>)

Creates a pageview, renders it and put the resulting markup into a template instance that can be used for further rendering. In the page that is being rendered, tags that will become available when this template is used for rendering, is accessible in the format {{tag.name}} Can be used to render a page and use the result for an email.

public static Template GetPageviewAsTemplate(int pageId, Dictionary<string, object> contextValues = null)

Parameters

pageId int

The page to render and use as markup for the template

contextValues Dictionary<string, object>

Context parameters i.e. orderid

Returns

Template

Template instance with the markup of the rendered page where tag placeholders ({{tag.name}}) is converted into regular template tags

GetPageviewByPageID(int)

Retrieves an instance of the pageview of page specified by page ID. Use PageView.Current for accessing the pageview instance in a frontend context.

public static PageView GetPageviewByPageID(int pageId)

Parameters

pageId int

ID of a page.

Returns

PageView

Remarks

Returns a PageView object of that page specified by page ID

GetPageviewByPageID(int, bool)

Retrieves an instance of the pageview of page specified by page ID.

public static PageView GetPageviewByPageID(int pageId, bool useCache)

Parameters

pageId int

ID of a page.

useCache bool

Value indicating whether to use internal cache of the PageView

Returns

PageView

Returns a PageView object of that page specified by page ID

GetPageviewModel()

public PageViewModel GetPageviewModel()

Returns

PageViewModel

GetParagraphViewModels()

public IList<ParagraphViewModel> GetParagraphViewModels()

Returns

IList<ParagraphViewModel>

Load()

Loads the PageView object with data. Usually Dynamicweb handles this.

public OutputResult Load()

Returns

OutputResult

A OutputResult indicating whether to process the pageview in its current state.

Remarks

Use Current(), or PageView.GetPageviewByPageID to get an instance.

Output()

Executes the pageview and parses all templates with content, modules and navigation.

public OutputResult Output()

Returns

OutputResult

The parsed HTML output of the pageview. Normally no need to call this as it is handled by Dynamicweb.

SetCurrentParagraph(Paragraph)

public void SetCurrentParagraph(Paragraph paragraph)

Parameters

paragraph Paragraph
To top