Skip to main content

CmsContext Tutorials

Tutorial Home

Interface ICmsPage

Get information about the page which is the contxt for the currently running code.

The .Id attribute:

The id of the current site is (this is the same as TabId in DNN or Page.PageId in oqtane.): 39

  <h3>The .Id attribute:</h3>
  The id of the current site is (this is the same as <code>TabId</code> in DNN or <code>Page.PageId</code> in oqtane.): 
  <strong>
    @CmsContext.Page.Id
  </strong>

Access all parameters with .Parameters:

Use this to get a string which contains all url parameters: c140=page

  <h3>Access all parameters with .Parameters:</h3>
  Use this to get a string which contains all url parameters:
  <strong>
    @CmsContext.Page.Parameters.ToString()
  </strong>

Access a specific parameter with .Parameters:

Use this to access the value of a specific url parameter: page

  <h3>Access a specific parameter with .Parameters:</h3>
  Use this to access the value of a specific url parameter:
  <strong>
    @CmsContext.Page.Parameters["c140"]
  </strong>

Source Code of this file

Below you'll see the source code of the file. Note that we're just showing the main part, and hiding some parts of the file which are not relevant for understanding the essentials. Click to expand the code

@inherits Custom.Hybrid.Razor14

<!-- unimportant stuff, hidden -->
Interface ICmsPage Get information about... <!-- unimportant stuff, hidden -->


  <h3>The .Id attribute:</h3>
  The id of the current site is (this is the same as <code>TabId</code> in DNN or <code>Page.PageId</code> in oqtane.): 
  <strong>
    @CmsContext.Page.Id
  </strong>




  <h3>Access all parameters with .Parameters:</h3>
  Use this to get a string which contains all url parameters:
  <strong>
    @CmsContext.Page.Parameters.ToString()
  </strong>




  <h3>Access a specific parameter with .Parameters:</h3>
  Use this to access the value of a specific url parameter:
  <strong>
    @CmsContext.Page.Parameters["c140"]
  </strong>



<!-- unimportant stuff, hidden -->