Tags
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.
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:
Available Get* methods:
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”).
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.