Documentation > CMS Template API Library > Asset > TemplateLabel

TemplateLabel

The Asset's Template folder label. . Will be blank, if the asset has no template.

Type

System.String

Value

The name of the folder which is set as this asset's template.

Code Example

C#

Sample:

              
            //Display a different graphic depending on the template
            Asset visualImage = null;
            if (asset.TemplateLabel.Equals("Detail Page"))
            {
            visual_image = Asset.Load("/Assets/images/header/page3_visual.jpg");
            }
            if (asset.TemplateLabel.Equals("Section Landing Page"))
            {
            visual_image = Asset.Load("/Assets/images/header/page2_visual.jpg");
            }
            string link = "";
            if (visual_image != null)
            {
            link = visual_image.GetLink();
            }
            

Connect with Crownpeak