Logo
Logo
  • Blazor CMS Home
  • Oqtane Tutorials
  • Blazor CMS Home
  • Oqtane Tutorials
Oqtane Tutorials
Oqtane Tutorials

External Data from CSV or SQL

Tutorial Home › External Data
Various SQL Samples
#3 Use DNN APIs to get DNN Data
LINQ Basics

Use DNN APIs to get DNN Data

DNN also provides a lot of data about users, pages etc. In this example, we'll list all the pages (tabs) in DNN and mark the one we're on. Please note that the DNN API isn't very consistent - so sometimes things use ID, sometimes Id, so best really verify the exact names as spelled in the API.

DNN also provides a lot of data about users, pages etc. In this example, we'll list all the pages (tabs) in DNN and mark the one we're on. Please note that the DNN API isn't very consistent - so sometimes things use ID, sometimes Id, so best really verify the exact names as spelled in the API.

⬇️ Result | Source ➡️

⚠️ Code Disabled in Oqtane 💧

This code only works in DNN, so the tutorial has special conditional statements like #if NETCOREAPP which disable the code in Oqtane.
@inherits Custom.Hybrid.Razor14

@{
  // get the pages
  var pages = DotNetNuke.Entities.Tabs.TabController.GetPortalTabs(CmsContext.Site.Id, 0, true, false);
  var current = DotNetNuke.Entities.Tabs.TabController.CurrentPage;
}

<ul>
  @foreach (DotNetNuke.Entities.Tabs.TabInfo dnnPage in pages) {
    <li class='@(dnnPage.TabID == current.TabID ? "selected" : "")'>
      <a href="@dnnPage.FullUrl" target="_blank">
        @dnnPage.TabName (#@dnnPage.TabID)
      </a>
    </li>
  }
</ul>

 

Various SQL Samples
#3 Use DNN APIs to get DNN Data
LINQ Basics
  • 2sic internet solutions
  • Langäulistrasse 62, 9470 Buchs SG, Switzerland
  • +41 81 750 67 77
Login