App


External Data from CSV or SQL

Tutorial HomeExternal Data
#3 Use DNN APIs to get DNN Data

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 ➡️

@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>

 

#3 Use DNN APIs to get DNN Data