When you're using Razor templates you can access the important DNN objects through the variable called Dnn.
So for quick binding of the ModuleId you would do something like
- <div>@Dnn.Module.ModuleID</div>
- <div id="form@Dnn.Module.ModuleID</div>
- @{ var mid = Dnn.Module.ModuleID; }
The objects attached to the DNN are the standard Razorhost DNN-Variables, namely
- Dnn.Module - the current module
- Dnn.Tab - Information about the current page
- Dnn.Portal - the portal we're on
- Dnn.User - the current user
This is the data-type (and a link to some older documentation) of each object (see the Dnn-Code on Github)
- Dnn.Module is ModuleInfo
- Dnn.Tab is a TabInfo
- Dnn.Portal is a PortalSetting
- Dnn.User is a UserInfo
The full list of APIs, Properties etc. can be found in the API-docs