Mapping External Template in Sitefinity with the API

Mapping External Template in Sitefinity with the API

August 05, 2013 0 Comments

The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.

The ability to map external templates to different Sitefinity widgets is performed in the backend UI from Administration->Settings->Advanced->Controls->View Map.

To perform the mapping of a template trough code refer to the sample below:
var configManager = ConfigManager.GetManager();
            var viewMap = configManager.GetSection<ControlsConfig>();
            ConfigProperty property;
            var viewMapValue = viewMap.Properties.TryGetValue("viewMap", out property);
            string[][] bag = new string[4][];
            bag[0] = new string[2] { "Value", "Telerik.Sitefinity.Web.UI.NavigationControls.SiteMapNavigations.SiteMapNavigationTabStrip, Telerik.Sitefinity" };
            bag[1] = new string[2] { "Key", "HostType" };
            bag[2] = new string[2] { "Value", "~/CustomNavigationTemplate.ascx" };
            bag[3] = new string[2] { "Key", "LayoutTemplatePath" };
            var ConfigSectionItems = new ConfigSectionItems();
            ConfigSectionItems.SaveBatchConfigSection(bag, "ViewMap_0,controlsConfig_0", "", "", null, "New", "");
The highlighted part of the code contains the required values for mapping a template, those are the host control type and a path to the mapped template.

Layout Template: ~/CustomNavigationTemplate.ascx

Additional approaches in mapping external templates are described in this blog post.

Stanislav Velikov

Stanislav Velikov is a Tech Support Engineer at Telerik. He joined the Sitefinity Support team in April 2011.

Comments are disabled in preview mode.
Latest Stories in
Your Inbox
More From Progress
5 Questions Automakers Should Ask to Improve Asset Uptime
Download Whitepaper
2018 Gartner Magic Quadrant Web Content Management (WCM)
Download Whitepaper
What Serverless Means for Enterprise Apps
Watch Webinar