To save time and make site administration easier for our Kentico customers, we often create a custom module to give them a custom control center.
We do that because Kentico is a very robust system. The official site touts 400+ web parts, and a quick glance at the two administrative portals reveals 13 admin tabs, most with many areas underneath them.
For a new user, getting up to speed with the content areas takes a bit of getting used to, and if you have a deeper site with custom tables or email templates they can quickly get lost trying to find those “once in a while” areas.
Step 1 – Create a custom module as a frameset
Creating a custom module is pretty easy and well covered at Kentico’s site here: http://devnet.kentico.com/docs/devguide/index.html?custom_modules.htm
So rather than go through those steps, I’m going to try to go over some useful tips for setting up the actual module. I recommend creating the module as a frameset so that you can add additional items easily:
A splash screen or introduction will provide a reminder of what each item can be used for in words that the client can easily understand and remember. To do this, create a basic frameset like so:
<%@ Page Language="C#" AutoEventWireup="true"
title="My Custom Module" CodeFile="Default.aspx.cs" Inherits="CustomModule.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
<head runat="server" enableviewstate="false">
<title>Custom Module Frameset</title>
<frameset border="0" rows="73, *" id="rowsFrameset">
<frame name="CustomModuleHeader" src="Header.aspx" frameborder="1"
scrolling="no" noresize="noresize" />
<frame name="CustomModuleContent" src="splash.aspx" frameborder="0" />
<p>This HTML frameset displays multiple Web pages. To view this frameset,
use a Web browser that supports HTML 4.0 and later. </p>
Step 2 – Add some tabs to your modules navigation
Kentico has a nice tab header that can be used for this on the header.aspx page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Header.aspx.cs"
MasterPageFile="~/CMSMasterPages/UI/TabsHeader.master" Title="[Your Title Here]"
Inherits="[Your Class Name]"
To add tabs to the page use a string array as follows. Each page in the module should inherit from CMS.UIControls.CMSToolsPage The first index of the string array should be updated for the number of tabs, the second index maps to one of the properties below:
- 0 – Caption
- 1 – Onclick event (not usually
- 2 – URL of the link target
- 3 – Tooltip
- 4 to 11 – these are used for additional styling, which probably isn’t needed in most cases
string[,] tabs = new string[4, 4];
tabs[indx, 0] = "Latest Activity";
tabs[indx, 1] = "";
tabs[indx, 2] = "Splash.aspx" ;
// Repeat above for all of your tabs
// This sets the tabs in the master page to the array that set above
this.CurrentMaster.Tabs.Tabs = tabs;
// This must be the same as the name of your
// content frame in the aspx code for frameset page.
this.CurrentMaster.Tabs.UrlTarget = "CustomModuleContent";
The indx variable works well so you can reorder the tab sections easily. And remember that for that first array the string constructor is 1 based, but the accessor is zero based. So if you declare – new string [4,4] as above you can only create 4 tabs (which would be tabs[3, 0] ) . Also – a key thing to note is that the URL doesn’t need to be a custom module page. It can be any valid URL, recent site we launched leveraged a good deal of Kentico’s modules for custom tables, product data, and email templates. This meant the content editor had to traverse several different menu options in order to find what he needed. An easy solution for this was to create links to custom tabs as navigation items in the module. Another easy feature was to create a page with links to specific email templates from within the module. Doing this means not having to find the right menu item, and in the case of email templates, find the right template out of all the different site templates that are in place. Kentico users will notice that “email template” includes site template, global templates, and ecommerce receipts. So this saves, clicks, supports calls and frustration and lets the client get to the important job of tweaking messaging for his customers.
// Link to custom tables by just getting the link of the table.
//For more complex deployments you will need to get the
//customtableID using data classes or a setting.
tabs[indx, 0] = "Subscriptions"; // NAME
tabs[indx, 2] =
tabs[indx, 3] = "General Subscription Details."; // TITLE
// You can also link to common admin tasks, like the user listing
tabs[indx, 0] = "User Details"; // NAME
tabs[indx, 2] = "/CMSModules/Membership/Pages/Users/User_List.aspx?siteid=2";
tabs[indx, 3] = "View All User Details. Use ‘Custom Fields’ for details";
//or the orders under the ecommerce module
tabs[indx, 0] = "Orders"; // NAME
tabs[indx, 2] = "/CMSModules/Ecommerce/Pages/Tools/Orders/Order_List.aspx"; // LINK
tabs[indx, 3] = "View order details and process."; // TITLE
Example 2: Make it easier to audit content
One of the first implementations we used was for a general content review. Using the unigrid and a custom table (more on that in another post) we built this module to make it easier to find incomplete physician records. As fields and criteria were added, we were able to expand the filter with different targeted database queries to help them zero in on what needed to be updated. A simple CSV export made it easy to create contact sheets for follow up and deep links to the CMS made it quick to update the physicians record. The
With custom modules the possibilities are endless. Well, not really, but it is a very powerful tool. You can of course create modules to support custom development (that is, after all, one of the best reasons to use Kentico). but always be on the lookout for easy modifications that offer high reward. A few hours building custom modules is the the final piece to the puzzle that turns a satisfied client into a grateful and happy Kentico user.