Class HtmlTemplates
- Namespace
- SunamoHtml.Generators
- Assembly
- SunamoHtml.dll
EN: Static class containing HTML template constants and helper methods for common HTML elements. CZ: Statická třída obsahující HTML šablony konstanty a pomocné metody pro běžné HTML elementy.
public static class HtmlTemplates
- Inheritance
-
HtmlTemplates
- Inherited Members
Fields
HtmlEnd
Closing body and html tags.
public const string HtmlEnd = "</body></html>"
Field Value
HtmlEndHeadBody
Closing head tag and opening body tag.
public const string HtmlEndHeadBody = "</head><body>"
Field Value
HtmlEndTitle
Closing title tag.
public const string HtmlEndTitle = "</title>"
Field Value
HtmlEndTitleBody
Closing title tag, closing head tag, and opening body tag. EN: Use this only when you don't need to add anything to the head section, otherwise use the separate constants. CZ: Použij toto pouze když nepotřebuješ nic přidat do head sekce, jinak použij oddělené konstanty.
public const string HtmlEndTitleBody = "</title></head><body>"
Field Value
HtmlStartTitle
HTML document start with DOCTYPE and opening head/title tags.
public const string HtmlStartTitle = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"https://www.w3.org/1999/xhtml\" ><head><title>"
Field Value
Methods
Anchor(string, string)
Generates an anchor link.
public static string Anchor(string href, string displayText)
Parameters
Returns
- string
HTML anchor element string.
GetH2(string)
Generates an H2 heading with specific CSS classes.
public static string GetH2(string title)
Parameters
titlestringThe heading text.
Returns
- string
HTML h2 element string.
HiddenField(string, string)
Generates a hidden input field with id and value.
public static string HiddenField(string id, string value)
Parameters
idstringThe id attribute for the hidden field.
valuestringThe value attribute for the hidden field.
Returns
- string
HTML hidden input field string.
Img(string, string)
Generates an img tag with src and alt attributes.
public static string Img(string src, string alt)
Parameters
Returns
- string
HTML img tag string.
Mail(HtmlGenerator)
Writes a mailto link for radek.jancik@sunamo.cz.
public static void Mail(HtmlGenerator generator)
Parameters
generatorHtmlGeneratorThe HTML generator to write to.
NameValueBr(string, string)
Generates a name-value pair with bold name and line break.
public static string NameValueBr(string name, string value)
Parameters
Returns
- string
HTML string with formatted name-value pair.
Tr(string, string, bool)
Generates a table row with two cells (name and value).
public static string Tr(string name, string value, bool isAddColon)
Parameters
namestringThe name/label for the first cell.
valuestringThe value for the second cell.
isAddColonboolWhether to add a colon after the name.
Returns
- string
HTML tr element string.
TrColspan2(string, string, bool)
Generates two table rows with colspan='2' cells (header row with bold name, data row with value).
public static string TrColspan2(string name, string value, bool isAddColon)
Parameters
namestringThe name/label for the header row.
valuestringThe value for the data row.
isAddColonboolWhether to add a colon after the name.
Returns
- string
HTML string with two tr elements.