Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/DNN-Connect/SkinControls
DNN Connect skin controls suite
https://github.com/DNN-Connect/SkinControls
dotnetnuke
Last synced: 3 months ago
JSON representation
DNN Connect skin controls suite
- Host: GitHub
- URL: https://github.com/DNN-Connect/SkinControls
- Owner: DNN-Connect
- Created: 2015-10-22T20:20:19.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-09-11T09:37:26.000Z (about 6 years ago)
- Last Synced: 2024-07-29T01:30:27.793Z (3 months ago)
- Topics: dotnetnuke
- Language: C#
- Size: 44.9 KB
- Stars: 5
- Watchers: 8
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-dnn - SkinControls
README
# DNN Connect Skin Controls
This is a suite of controls that allow you to create some powerful functionality in a skin.
Central is the use of Razor files. These are loaded as a control into the ascx of your skin
as follows:``` asp
```
The ControlName can be either User or Login for now. These then set the property
ControlSource which points to the actual name of the file. If you choose Login then
ControlSource will be either LoginAuthenticated or LoginUnauthenticated. Similarly
for ControlName="User" the ControlSource with be either UserAuthenticated or UserUnauthenticated.
But you can specify your own ControlSource directly of course. It's just that Login and User
have the ability to switch between the state of the user being authenticated or not.The ControlPath tells it whether it will find the file in the system (DesktopModules) path
or in the skin folder (under the folder "Controls"). The latter is the preferred method
and keeps everything with the skin.``` csharp
if (string.IsNullOrEmpty(ControlPath))
{
ControlPath = "/DesktopModules/Connect/SkinControls/Controls/";
}
if (ControlPath.ToLower() == "skin")
{
ControlPath = PortalSettings.ActiveTab.SkinPath + "Controls/";
}
```The ControlSource eventually leads to the Razor file which is expected to be a cshtml.
``` csharp
public RazorEngine Engine
{
get { return _engine ?? (_engine = new RazorEngine(string.Format("~{0}{1}.cshtml", ControlPath, ControlSource), Attributes, PortalSettings, LocalResourceFile)); }
}
```The Razor files inherit from Connect.DNN.Modules.SkinControls.Razor.SkinControlWebPage.
Besides the usual suspects Dnn, Html and Url this also includes a property Ctl which gives access
to the encapsulating control. This way you can pass values through attributes to the Razor file
like this:``` asp
```And in the Razor file:
``` csharp
int intRootLevel = 0;
if (Ctl.Item("RootLevel") != null)
{
Int32.TryParse(Ctl.Item("RootLevel"), out intRootLevel);
}
```