Skip to main content
Home  › ... Razor

CmsContext Tutorials

Tutorial HomeCmsContext

Interface ICmsModule

Get information about the module context the code is running in.

Output

The .Id attribute:

The id of the current module: 4480
<h3>The .Id attribute:</h3>
The id of the current module: 
<strong>
  @CmsContext.Module.Id
</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
@using ToSic.Razor.Blade;
<!-- unimportant stuff, hidden -->


<div @Sys.PageParts.InfoWrapper()>
  @Html.Partial("../shared/DefaultInfoSection.cshtml")
  <div @Sys.PageParts.InfoIntro()>
      <h2>Interface ICmsModule</h2>
      <p>
        Get information about the module context the code is running in.
      </p>
    </div>
  </div>

  <h3>The .Id attribute:</h3>
  The id of the current module: 
  <strong>
    @CmsContext.Module.Id
  </strong>


@* Footer *@
@Html.Partial("../Shared/Layout/FooterWithSource.cshtml", new { Sys = Sys })