Tags

Template tags are used to output data from Dynamicweb. 

To get the value of a tag, use a method called GetValue: @GetValue("ParagraphText") The GetValue method will return a representation of the property specified (ParagraphText) as a System.Object. This is a paragraph template and how it will look in Razor compared to HTML syntax. 

<div class="paragraph module"> @GetValue("ParagraphText") </div> <div class="paragraph module"> @GetValue("ParagraphModule") </div> <div class="paragraph module"> @GetValue("ParagraphImage") </div>

Tags in Dynamicweb HTML templates are always strings. When using Razor the tag values are in the type they are, either string, integer, boolean, double, long or date.

When using GetValue("TagName") an object is returned containing the value. If the tag value has to be part of a conditional, needs to be formatted or otherwise be part of any code blocks, put the value into a variable of the correct type using type specific GetValue equivalents. Create a string variable using GetString

@{ string paragraphText = GetString("ParagraphText"); }

Available Get* methods:

@GetValue("TagName") @GetString("TagName") @GetInteger("TagName") @GetBoolean("TagName") @GetDouble("TagName") @GetLong("TagName") @GetDate("TagName")

These Get methods returns safe values – meaning i.e. GetInteger will ALWAYS return a valid integer. If the passed tag name does not exist or is not an integer, it will return 0. If the original value is required, including null references etc, use i.e. (int)GetValue(“TagName”).

<div class="paragraph module"> <!--@ParagraphText--> </div> <div class="paragraph module"> <!--@ParagraphModule--> </div> <div class="paragraph module"> <!--@ParagraphImage--> </div>

It is possible to output all available template tags and loops in the current template by inserting @TemplateTags() in the Razor code or <!--@DwTemplateTags--> in the HTML code.
Read more about TemplateTags.