Mapping External Template in Sitefinity with the API

Mapping External Template in Sitefinity with the API

Posted on 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.

Host:Telerik.Sitefinity.Web.UI.NavigationControls.SiteMapNavigations.SiteMapNavigationTabStrip
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

Comments are disabled in preview mode.
Topics

Sitefinity Training and Certification Now Available.

Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.

Learn More
Latest Stories
in Your Inbox

Subscribe to get all the news, info and tutorials you need to build better business apps and sites

Loading animation