DNN client variables

In DNN, how can I get portal parameters such as page id, portal language, etc. how is the variable for javascript? I tried something like this:

<% DotNetNuke.UI.Utilities.ClientAPI.RegisterClientVariable(Me.Page, "pageTitle", PortalSettings.ActiveTab.TabName, True) %>

and

var pageTitle = dnn.getVar('pageTitle');

but no luck, it just shows that the variable "PageTitle" is undefined.

+4
source share
1 answer

Example from: https://github.com/ChrisHammond/dnnCHAT/blob/master/View.ascx

<script type="text/javascript">
   var moduleId:<%= ModuleId %>;
   var tabId:<%= TabId %>;
</script>

Where ModuleId is the parameter you want to set. If you are doing something with portalsettings, you can do PortalSettings.PortalName or any other valid value.

+3
source

All Articles