Table of Contents

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

string

HtmlEndHeadBody

Closing head tag and opening body tag.

public const string HtmlEndHeadBody = "</head><body>"

Field Value

string

HtmlEndTitle

Closing title tag.

public const string HtmlEndTitle = "</title>"

Field Value

string

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

string

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

string

Methods

Anchor(string, string)

Generates an anchor link.

public static string Anchor(string href, string displayText)

Parameters

href string

The href URL.

displayText string

The text to display.

Returns

string

HTML anchor element string.

GetH2(string)

Generates an H2 heading with specific CSS classes.

public static string GetH2(string title)

Parameters

title string

The 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

id string

The id attribute for the hidden field.

value string

The 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

src string

The image source URL.

alt string

The alt text for the image.

Returns

string

HTML img tag string.

Mail(HtmlGenerator)

Writes a mailto link for radek.jancik@sunamo.cz.

public static void Mail(HtmlGenerator generator)

Parameters

generator HtmlGenerator

The 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

name string

The name/label.

value string

The value.

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

name string

The name/label for the first cell.

value string

The value for the second cell.

isAddColon bool

Whether 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

name string

The name/label for the header row.

value string

The value for the data row.

isAddColon bool

Whether to add a colon after the name.

Returns

string

HTML string with two tr elements.