Skip to main content

CmsContext Tutorials

Tutorial Home
#7 CmsContext.View – ID, Identifier, Edition, Name, etc.

Interface ICmsView

Get information about the view context.

The .Edition attribute:

Get information about the edition used (otherwise it returns an empty string):

  <h3>The .Edition attribute:</h3>
  Get information about the edition used (otherwise it returns an empty string): 
  <strong>
    @CmsContext.View.Edition
  </strong>

The .Id attribute:

Get the id of the view configuration: 6596

  <h3>The .Id attribute:</h3>
  Get the id of the view configuration: 
  <strong>
    @CmsContext.View.Id
  </strong>

The .Identifier attribute:

An optional identifier which the View configuration can provide. Use this when you want to use the same template but make minor changes based on the View selected (like change the number of columns). Usually you will use either this OR the Settings:

  <h3>The .Identifier attribute:</h3>
  An optional identifier which the View configuration can provide. 
  Use this when you want to use the same template but make minor changes based on the View selected (like change the number of columns). 
  Usually you will use either this OR the Settings: 
  <strong>
    @CmsContext.View.Identifier
  </strong>

The .Name attribute:

Name of the view as configured - note that because of i18n it could be different depending on the language. To clearly identify a view, use the Identifier or use Settings: C170 View

  <h3>The .Name attribute:</h3>
  Name of the view as configured - note that because of i18n it could be different depending on the language. 
  To clearly identify a view, use the Identifier or use Settings: 
  <strong>
    @CmsContext.View.Name
  </strong>
#7 CmsContext.View – ID, Identifier, Edition, Name, etc.

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 ICmsView Get information about... <!-- unimportant stuff, hidden -->


  <h3>The .Edition attribute:</h3>
  Get information about the edition used (otherwise it returns an empty string): 
  <strong>
    @CmsContext.View.Edition
  </strong>




  <h3>The .Id attribute:</h3>
  Get the id of the view configuration: 
  <strong>
    @CmsContext.View.Id
  </strong>




  <h3>The .Identifier attribute:</h3>
  An optional identifier which the View configuration can provide. 
  Use this when you want to use the same template but make minor changes based on the View selected (like change the number of columns). 
  Usually you will use either this OR the Settings: 
  <strong>
    @CmsContext.View.Identifier
  </strong>




  <h3>The .Name attribute:</h3>
  Name of the view as configured - note that because of i18n it could be different depending on the language. 
  To clearly identify a view, use the Identifier or use Settings: 
  <strong>
    @CmsContext.View.Name
  </strong>



<!-- unimportant stuff, hidden -->