Table of contents
- 1 Constructors
- 2 Methods
- 2.1 FieldSet(String legend) : String
- 2.2 EndFieldSet() : String
- 2.3 Form(String action) : String
- 2.4 Form(String action, String id, String method) : String
- 2.5 Form(String action, String id, String method, String onSubmit) : String
- 2.6 Form(String action, IDictionary attributes) : String
- 2.7 EndForm() : String
- 2.8 Link(String target, String linkText) : String
- 2.9 Link(String target, String linkText, IDictionary attributes) : String
- 2.10 LinkTo(String name, String action) : String
- 2.11 LinkTo(String name, String controller, String action) : String
- 2.12 LinkTo(String name, String controller, String action, Object id) : String
- 2.13 LinkToAttributed(String name, String controller, String action, IDictionary attributes) : String
- 2.14 LinkToAttributed(String name, String controller, String action, Object id, IDictionary attributes) : String
- 2.15 MapToVirtual(String target) : String
- 2.16 LabelFor(String forId, String label) : String
- 2.17 LabelFor(String forId, String label, IDictionary attributes) : String
- 2.18 DateTime(String name, DateTime value) : String
- 2.19 DateTime(String name, DateTime value, IDictionary attributes) : String
- 2.20 TextArea(String name, Int32 cols, Int32 rows, String value) : String
- 2.21 InputButton(String value) : String
- 2.22 InputButton(String name, String value) : String
- 2.23 InputButton(String name, String value, IDictionary attributes) : String
- 2.24 InputCheckbox(String name, Object value) : String
- 2.25 InputCheckbox(String name, Object value, Boolean isChecked) : String
- 2.26 InputCheckbox(String name, Object value, IDictionary attributes) : String
- 2.27 InputRadio(String name, Object value) : String
- 2.28 InputRadio(String name, Object value, IDictionary attributes) : String
- 2.29 InputFile(String name) : String
- 2.30 InputFile(String name, IDictionary attributes) : String
- 2.31 InputText(String name, String value) : String
- 2.32 InputText(String name, String value, Int32 size, Int32 maxlength) : String
- 2.33 InputText(String name, String value, Int32 size, Int32 maxlength, IDictionary attributes) : String
- 2.34 InputText(String name, String value, String id) : String
- 2.35 InputText(String name, String value, IDictionary attributes) : String
- 2.36 InputPassword(String name) : String
- 2.37 InputPassword(String name, String value) : String
- 2.38 InputPassword(String name, String value, IDictionary attributes) : String
- 2.39 InputHidden(String name, String value) : String
- 2.40 InputHidden(String name, Object value) : String
- 2.41 SubmitButton(String value) : String
- 2.42 SubmitButton(String value, IDictionary attributes) : String
- 2.43 Select(String name) : String
- 2.44 Select(String name, IDictionary attributes) : String
- 2.45 EndSelect() : String
- 2.46 OptionGroup(String label) : String
- 2.47 EndOptionGroup() : String
- 2.48 CreateOption(String text, Object value) : String
- 2.49 CreateOption(String text, Object value, IDictionary htmlAttributes) : String
- 2.50 CreateOptionsFromPrimitiveArray(Array elems, String selected) : String
- 2.51 CreateOptionsFromArray(Array elems, String textProperty, String valueProperty) : String
- 2.52 CreateOptionsFromArray(Array elems, String textProperty, String valueProperty, Object selectedValue) : String
- 2.53 CreateOptions(ICollection elems, String textProperty, String valueProperty) : String
- 2.54 CreateOptions(ICollection elems, String textProperty, String valueProperty, Object selectedValue) : String
- 2.55 BuildUnorderedList(ICollection elements) : String
- 2.56 BuildUnorderedList(ICollection elements, String styleClass, String itemClass) : String
- 2.57 BuildOrderedList(ICollection elements) : String
- 2.58 BuildOrderedList(ICollection elements, String styleClass, String itemClass) : String
HtmlHelper API Document
Provides usefull common methods to generate HTML tags.
This helper provides the means to generate commonly used HTML tags. All of it's methods return System.String that holds resulting HTML.
Constructors
HtmlHelper()
Initializes a new instance of the Castle.MonoRail.Framework.Helpers.HtmlHelper class.
Methods
FieldSet(String legend) : String
Creates a fieldset
tag with a legend.
<fieldset><legend>legendArg</legend>
Example
This example shows how to use Castle.MonoRail.Framework.Helpers.HtmlHelper.FieldSet(System.String) together with Castle.MonoRail.Framework.Helpers.HtmlHelper.EndFieldSet:
$HtmlHelper.FieldSet( "legendArg" )
...
$HtmlHelper.EndFieldSet()
Calling FieldSet( "legendArg" )
results in:
<fieldset><legend>legendArg</legend>
| Parameter | Description |
|---|---|
| legend | Legend to use within the fieldset. |
EndFieldSet() : String
Creates a closing fieldset
tag.
</fieldset>
Example
This example shows how to use Castle.MonoRail.Framework.Helpers.HtmlHelper.FieldSet(System.String) together with Castle.MonoRail.Framework.Helpers.HtmlHelper.EndFieldSet:
$HtmlHelper.FieldSet( "legendArg" )
...
$HtmlHelper.EndFieldSet()
This method should be invoked after Castle.MonoRail.Framework.Helpers.HtmlHelper.FieldSet(System.String) to close the fieldset. Calling EndFieldSet()
results in:
</fieldset>
Form(String action) : String
Creates a form tag with "post" method and specified action
.
<form method="post" action="actionArg">
Example
This example shows how to use Castle.MonoRail.Framework.Helpers.HtmlHelper.Form(System.String) together with Castle.MonoRail.Framework.Helpers.HtmlHelper.EndForm:
$HtmlHelper.Form( "actionArg" )
...
$HtmlHelper.EndForm()
Calling Form( "actionArg" )
results in:
<form method="post" action="actionArg">
| Parameter | Description |
|---|---|
| action | Target action for the form. |
Form(String action, String id, String method) : String
Creates a form tag with specified method, action and id
.
<form method="methodArg" action="actionArg" id="idArg">
Example
This example shows how to use Form together with Castle.MonoRail.Framework.Helpers.HtmlHelper.EndForm:
$HtmlHelper.Form( "actionArg", "idArg", "methodArg" ) ... $HtmlHelper.EndForm()
Calling Form( "actionArg", "idArg", "methodArg" )
results in:
<form method="methodArg" action="actionArg" id="idArg">
| Parameter | Description |
|---|---|
| action | Target action for the form. |
| id | Form HTML ID. |
| method | Form method (get, post, etc). |
Form(String action, String id, String method, String onSubmit) : String
Creates a form tag with specified method, action, id and onSubmit
event handler.
<form method="methodArg" action="actionArg" id="idArg" onsubmit="onSubmitArg">
Example
This example shows how to use Form together with Castle.MonoRail.Framework.Helpers.HtmlHelper.EndForm:
$HtmlHelper.Form( "actionArg", "idArg", "methodArg", "submitHandler()" ) ... $HtmlHelper.EndForm()
Calling Form( "actionArg", "idArg", "methodArg", "onSubmitArg" )
results in:
<form method="methodArg" action="actionArg" id="idArg" onsubmit="onSubmitArg">
| Parameter | Description |
|---|---|
| action | Target action for the form. |
| id | Form HTML ID. |
| method | Form method (get, post, etc). |
| onSubmit | JavaScript inline code to be invoked upon form submission. |
Form(String action, IDictionary attributes) : String
Creates a form tag the specified action
.
<form action="actionArg">
| Parameter | Description |
|---|---|
| action | Target action for the form. |
| attributes | Html Attributes for the form tag |
EndForm() : String
Creates a closing form
tag.
</form>
Example
This example shows how to use Castle.MonoRail.Framework.Helpers.HtmlHelper.Form(System.String) together with Castle.MonoRail.Framework.Helpers.HtmlHelper.EndForm:
$HtmlHelper.Form( "actionArg", "idArg", "methodArg", "submitHandler()" ) ... $HtmlHelper.EndForm()
Calling EndForm()
results in:
</form>
Link(String target, String linkText) : String
Creates an anchor (link) to the target
<a href="/sometarget.html">linkText</a>
Example
This example shows how to use Link:
$HtmlHelper.Link( "mypage.html", "This is a link to my page" )
Calling Link( "something.html", "to something" )
results in:
<a href="something.html">something</a>
| Parameter | Description |
|---|---|
| target | link's target. |
| linkText | Text of the link. |
Link(String target, String linkText, IDictionary attributes) : String
Creates an anchor (link) to the target
<a href="/sometarget.html">linkText</a>
Example
This example shows how to use Link:
$HtmlHelper.Link( "mypage.html", "This is a link to my page", $DictHelper.CreateDict("class=mylinkclass") )
Calling Link( "something.html", "to something", $DictHelper.CreateDict("class=mylinkclass") )
results in:
<a href="something.html" class="mylinkclass">something</a>
| Parameter | Description |
|---|---|
| target | link's target. |
| linkText | Text of the link. |
| attributes | Additional attributes for the a tag. |
LinkTo(String name, String action) : String
Creates an anchor (link) to the action
on the current controller.
<a href="/website/currentController/actionArg.rails">nameArg</a>
Example
This example shows how to use LinkTo:
$HtmlHelper.LinkTo( "linkName", "requiredAction" )
Calling LinkTo( "nameArg", "actionArg" )
results in:
<a href="/websiter/currentController/actionArg.rails">nameArg</a>
| Parameter | Description |
|---|---|
| name | Name for the link. |
| action | Action to link to. |
LinkTo(String name, String controller, String action) : String
Creates an anchor (link) to the action on the specified controller
.
<a href="/website/controllerArg/actionArg.rails">nameArg</a>
Example
This example shows how to use LinkTo:
$HtmlHelper.LinkTo( "linkName", "someController", "requiredAction" )
Calling LinkTo( "nameArg", "controllerArg", "actionArg" )
results in:
<a href="/website/controllerArg/actionArg.rails">nameArg</a>
| Parameter | Description |
|---|---|
| name | Name for the link. |
| controller | Controller to link to. |
| action | Action to link to. |
LinkTo(String name, String controller, String action, Object id) : String
Creates an anchor (link) to the action on the specified controller passing provided id
.
<a href="/website/controllerArg/actionArg.rails?id=objectId">nameArg</a>
Example
This example shows how to use LinkTo:
$HtmlHelper.LinkTo( "linkName", "someController", "requiredAction", objectToRefByID )
Calling LinkTo( "nameArg", "controllerArg", "actionArg", object )
results in:
<a href="/website/controllerArg/actionArg.rails?id=object">nameArg</a>
System.String.Format(System.String,System.Object) is used to convert id to the actual System.String.
| Parameter | Description |
|---|---|
| name | Name for the link. |
| controller | Controller to link to. |
| action | Action to link to. |
| id | Object to use for the action ID argument. |
LinkToAttributed(String name, String controller, String action, IDictionary attributes) : String
Creates an anchor (link) to the action on the specified controller
<a href="/website/controllerArg/actionArg.rails">nameArg</a>
Example
This example shows how to use LinkToAttributed:
$HtmlHelper.LinkToAttributed( "linkName", "someController", "requiredAction", $DictHelper.CreateDict("class=something") )
Calling LinkToAttributed( "nameArg", "controllerArg", "actionArg", IDictionary )
results in:
<a href="/website/controllerArg/actionArg.rails">nameArg</a>
| Parameter | Description |
|---|---|
| name | Name for the link. |
| controller | Controller to link to. |
| action | Action to link to. |
| attributes | Additional attributes for the a tag. |
LinkToAttributed(String name, String controller, String action, Object id, IDictionary attributes) : String
Creates an anchor (link) to the action on the specified controller
<a href="/website/controllerArg/actionArg.rails?id=x">nameArg</a>
Example
This example shows how to use LinkToAttributed:
$HtmlHelper.LinkToAttributed( "linkName", "someController", "requiredAction", $DictHelper.CreateDict("class=something") )
Calling LinkToAttributed( "nameArg", "controllerArg", "actionArg", IDictionary )
results in:
<a href="/website/controllerArg/actionArg.rails">nameArg</a>
| Parameter | Description |
|---|---|
| name | Name for the link. |
| controller | Controller to link to. |
| action | Action to link to. |
| id | The ID to be passed as a parameter for the action |
| attributes | Additional attributes for the a tag. |
MapToVirtual(String target) : String
Maps target
to website virtual path.
/website/targetArg
Example
This example shows how to use Castle.MonoRail.Framework.Helpers.HtmlHelper.MapToVirtual(System.String):
$HtmlHelper.MapToVirtual( "targetFolder/targetFile.html" )
Calling MapToVirtual( "targetArg" )
results in:
/website/targetArg
| Parameter | Description |
|---|---|
| target | Target path to map. |
LabelFor(String forId, String label) : String
Creates a label for the element indicated with forId
.
<label for="forIdArg">labelArg</label>
Example
This example shows how to use Castle.MonoRail.Framework.Helpers.HtmlHelper.LabelFor(System.String,System.String):
$HtmlHelper.LabelFor( "forIdArg", "labelArg" )
Calling LabelFor( "forIdArg", "labelArg" )
results in:
<label for="forIdArg">labelArg</label>
| Parameter | Description |
|---|---|
| forId | ID of the element for which to create the lable. |
| label | Label name. |
LabelFor(String forId, String label, IDictionary attributes) : String
Creates a label for the element indicated with forId
.
<label key1="value1" key2="value2" for="forIdArg">labelArg</label>
Example
This example shows how to use Castle.MonoRail.Framework.Helpers.HtmlHelper.LabelFor(System.String,System.String):
$HtmlHelper.LabelFor( "forIdArg", "labelArg", IDictionary )
Calling LabelFor( "forIdArg", "labelArg", IDictionary )
results in:
<label key5="value5" key4="value4" key1="value1" key3="value3" key2="value2" for="forIdArg">labelArg</label>
| Parameter | Description |
|---|---|
| forId | ID of the element for which to create the label. |
| label | Label name. |
| attributes | Additional attributes to add to the label. |
DateTime(String name, DateTime value) : String
Creates three select
tags to input day, month and year.
<select name="nameArgday" id="nameArgday" > ... </select> <select name="nameArgmonth" id="nameArgmonth" > ... </select> <select name="nameArgyear" id="nameArgyear" > ... </select>
Example
This example shows how to use DateTime:
$HtmlHelper.DateTime( "nameArg", new DateTime( 2005, 07, 15 ) )
Calling DateTime( "nameArg", new DateTime( 2005, 07, 15 ) )
results in:
<select name="nameArgday" id="nameArgday" > <option>1</option>
<option>2</option>
...
<option>14</option>
<option selected>15</option>
<option>16</option>
...
<option>30</option>
<option>31</option>
</select> <select name="nameArgmonth" id="nameArgmonth" > <option>1</option>
<option>2</option>
...
<option>6</option>
<option selected>7</option>
<option>8</option>
...
<option>11</option>
<option>12</option>
</select> <select name="nameArgyear" id="nameArgyear" > <option>1930</option>
<option>1931</option>
...
<option>2004</option>
<option selected>2005</option>
<option>2006</option>
...
<option>2029</option>
</select> As above example shows the year range is hardcoded between 1930 and 2029. name is used to generate name and id for each select tag. Supplied System.String is concatenated with "day", "month", or "year" to create System.String for the tag attributes.
| Parameter | Description |
|---|---|
| name | Name to use with name and id arguments of the select tag. |
| value | System.DateTime to use for default selected date. |
DateTime(String name, DateTime value, IDictionary attributes) : String
Creates three select
tags to input day, month and year.
<select name="nameArgday" id="nameArgday" key1="value1" key3="value3" key2="value2" > ... </select> <select name="nameArgmonth" id="nameArgmonth" key1="value1" key3="value3" key2="value2" > ... </select> <select name="nameArgyear" id="nameArgyear" key1="value1" key3="value3" key2="value2" > ... </select>
Example
This example shows how to use DateTime:
$HtmlHelper.DateTime( "nameArg", new DateTime( 2005, 07, 15 ), IDictionary )
Calling DateTime( "nameArg", new DateTime( 2005, 07, 15 ), IDictionary )
results in:
<select name="nameArgday" id="nameArgday" key1="value1" key2="value2" > <option>1</option>
<option>2</option>
...
<option>14</option>
<option selected>15</option>
<option>16</option>
...
<option>30</option>
<option>31</option>
</select> <select name="nameArgmonth" id="nameArgmonth" key1="value1" key2="value2" > <option>1</option>
<option>2</option>
...
<option>6</option>
<option selected>7</option>
<option>8</option>
...
<option>11</option>
<option>12</option>
</select> <select name="nameArgyear" id="nameArgyear" key1="value1" key2="value2" > <option>1930</option>
<option>1931</option>
...
<option>2004</option>
<option selected>2005</option>
<option>2006</option>
...
<option>2029</option>
</select> As above example shows the year range is hardcoded between 1930 and 2029. name is used to generate name and id for each select tag. Supplied System.String is concatenated with "day", "month", or "year" to create System.String for the tag attributes.
attributes is used to generate additional attributes for each of the select tags. System.Collections.IDictionary.Keys are used to name attributes. System.Collections.IDictionary.Values are used to assign those attributes values.
| Parameter | Description |
|---|---|
| name | Name to use with name and id arguments of the select tag. |
| value | System.DateTime to use for default selected date. |
| attributes | Additional attributes for select tags. |
TextArea(String name, Int32 cols, Int32 rows, String value) : String
Creates a text area element.
<textarea id="nameArg" name="nameArg" cols="10" rows="10">valueArg</textarea>
Example
This example shows how to use Castle.MonoRail.Framework.Helpers.HtmlHelper.TextArea(System.String,System.Int32,System.Int32,System.String):
$HtmlHelper.TextArea( "nameArg", 10, 20, "Text inside text area." )
Calling TextArea( "nameArg", 10, 10, "valueArg" )
results in:
<textarea id="nameArg" name="nameArg" cols="10" rows="10">valueArg</textarea>
| Parameter | Description |
|---|---|
| name | Value for name and id attributes. |
| cols | cols attribute value. |
| rows | rows attribute value. |
| value | Text to place inside of the text area. |
InputButton(String value) : String
Creates an input element of the button type.
<input type="button" value="valueArg" />
Example
This example shows how to use InputButton:
$HtmlHelper.InputButton( "valueArg" )
Calling InputButton( "valueArg" )
results in:
<input type="button" name="valueArg" value="valueArg" />
| Parameter | Description |
|---|---|
| value | System.String for value attribute. |
InputButton(String name, String value) : String
Creates an input element of the button type.
<input type="button" name="nameArg" id="nameArg" value="valueArg" />
| Parameter | Description |
|---|---|
| name | Value for name and id attributes. |
| value | System.String for value attribute. |
InputButton(String name, String value, IDictionary attributes) : String
Creates an input element of the button type.
<input type="button" name="nameArg" id="nameArg" value="valueArg" />
| Parameter | Description |
|---|---|
| name | Value for name and id attributes. |
| value | System.String for value attribute. |
| attributes | Additional attributes for the input tag. |
InputCheckbox(String name, Object value) : String
Creates an input element of the checkbox type.
<input type="checkbox" name="nameArg" id="nameArg" value="valueArg" />
Calling InputCheckbox( "name", "1" )
results in:
<input type="checkbox" name="name" id="name" value="1" />
| Parameter | Description |
|---|---|
| name | Value for name and id attributes. |
| value | System.String for value attribute. |
InputCheckbox(String name, Object value, Boolean isChecked) : String
Creates an input element of the checkbox type.
<input type="checkbox" name="nameArg" id="nameArg" value="valueArg" />
| Parameter | Description |
|---|---|
| name | Value for name and id attributes. |
| value | System.String for value attribute. |
| isChecked | If true, adds the checked attributed to the tag |
InputCheckbox(String name, Object value, IDictionary attributes) : String
Creates an input element of the checkbox type.
<input type="checkbox" name="nameArg" id="nameArg" value="valueArg" />
| Parameter | Description |
|---|---|
| name | Value for name and id attributes. |
| value | System.String for value attribute. |
| attributes | Additional attributes for the input tag. |
InputRadio(String name, Object value) : String
Creates an input element of the radio type.
<input type="radio" name="nameArg" value="valueArg" />
Calling InputRadio( "name", "1" )
results in:
<input type="radio" name="name" value="1" />
| Parameter | Description |
|---|---|
| name | Value for name attribute. |
| value | System.String for value attribute. |
InputRadio(String name, Object value, IDictionary attributes) : String
Creates an input element of the radio type.
<input type="radio" name="nameArg" value="valueArg" />
| Parameter | Description |
|---|---|
| name | Value for name attribute. |
| value | System.String for value attribute. |
| attributes | Additional attributes for the input tag. |
InputFile(String name) : String
Creates an input element of the file type.
<input type="file" name="nameArg" />
Calling InputFile( "name" )
results in:
<input type="file" name="name" />
| Parameter | Description |
|---|---|
| name | Value for name attribute. |
InputFile(String name, IDictionary attributes) : String
Creates an input element of the file type.
<input type="file" name="nameArg" />
| Parameter | Description |
|---|---|
| name | Value for name attribute. |
| attributes | Additional attributes for the input tag. |
InputText(String name, String value) : String
Creates an input element of the text type.
<input type="text" name="nameArg" id="nameArg" value="valueArg" />
Example
This example shows how to use InputText:
$HtmlHelper.InputText( "nameArg", "valueArg" )
Calling InputText( "nameArg", "valueArg" )
results in:
<input type="text" name="nameArg" id="nameArg" value="valueArg" />
| Parameter | Description |
|---|---|
| name | Value for name and id attributes. |
| value | System.String for value attribute. |
InputText(String name, String value, Int32 size, Int32 maxlength) : String
Creates an input element of the text type of specified size and maxlength
.
<input type="text" name="nameArg" id="nameArg" value="valueArg" size="10" maxlength="10" />
Example
This example shows how to use InputText:
$HtmlHelper.InputText( "nameArg", "valueArg", 10, 10 )
Calling InputText( "nameArg", "valueArg", 10, 10 )
results in:
<input type="text" name="nameArg" id="nameArg" value="valueArg" size="10" maxlength="10" />
| Parameter | Description |
|---|---|
| name | Value for name and id attributes. |
| value | System.String for value attribute. |
| size | size attribute value. |
| maxlength | maxlength attribute value. |
InputText(String name, String value, Int32 size, Int32 maxlength, IDictionary attributes) : String
Creates an input element of the text type with specified size, maxlength and attributes
.
<input type="text" name="nameArg" id="nameArg" value="valueArg" size="10" maxlength="10" />
Example
This example shows how to use InputText:
$HtmlHelper.InputText( "nameArg", "valueArg", 10, 10, IDictionary )
Calling InputText( "nameArg", "valueArg", 10, 10, IDictionary )
results in:
<input type="text" name="nameArg" id="nameArg" value="valueArg" size="10" maxlength="10" key1="value1" key2="value2" />
attributes is used to generate additional attributes for the label tag. System.Collections.IDictionary.Keys are used to name attributes. System.Collections.IDictionary.Values are used to assign those attributes values.
| Parameter | Description |
|---|---|
| name | Value for name and id attributes. |
| value | System.String for value attribute. |
| size | size attribute value. |
| maxlength | maxlength attribute value. |
| attributes | Additional attributes for the input tag. |
InputText(String name, String value, String id) : String
Creates an input element of the text type with custom name and id
.
<input type="text" name="nameArg" id="idArg" value="valueArg" />
Example
This example shows how to use InputText:
$HtmlHelper.InputText( "nameArg", "valueArg", "idArg" )
Calling InputText( "nameArg", "valueArg", "idArg" )
results in:
<input type="text" name="nameArg" id="idArg" value="valueArg" />
| Parameter | Description |
|---|---|
| name | name attribute value. |
| value | System.String for value attribute. |
| id | id attribute value. |
InputText(String name, String value, IDictionary attributes) : String
Creates a hidden type input element.
<input type="hidden" name="nameArg" id="nameArg" value="valueArg" />
| Parameter | Description |
|---|---|
| name | Missing documentation |
| value | Missing documentation |
| attributes | Missing documentation |
InputPassword(String name) : String
Creates an input element of password type
| Parameter | Description |
|---|---|
| name | Missing documentation |
InputPassword(String name, String value) : String
Creates an input element of password type
| Parameter | Description |
|---|---|
| name | Missing documentation |
| value | Missing documentation |
InputPassword(String name, String value, IDictionary attributes) : String
Creates an input element of password type
| Parameter | Description |
|---|---|
| name | Missing documentation |
| value | Missing documentation |
| attributes | Missing documentation |
InputHidden(String name, String value) : String
Creates an input hidden element
Example
This example shows how to use InputHidden:
$HtmlHelper.InputHidden( "nameArg", "valueArg" )
Calling InputHidden( "nameArg", "valueArg" )
results in:
<input type="hidden" name="nameArg" id="nameArg" value="valueArg" />
| Parameter | Description |
|---|---|
| name | Value for name and id attributes. |
| value | System.String for value attribute. |
InputHidden(String name, Object value) : String
Creates a hidden type input element.
<input type="hidden" name="nameArg" id="nameArg" value="object" />
Example
This example shows how to use InputHidden:
$HtmlHelper.InputHidden( "nameArg", object )
Calling InputHidden( "nameArg", object )
results in:
<input type="hidden" name="nameArg" id="nameArg" value="object" />
System.String for value attribute is retrieved from value via System.Object.ToString.
If value is nullSystem.String.Empty is used as the valueSystem.String.
| Parameter | Description |
|---|---|
| name | Value for name and id attributes. |
| value | System.Object to supply System.String for value attribute. |
SubmitButton(String value) : String
Creates a submit button.
<input type="submit" value="valueArg" />
Example
This example shows how to use SubmitButton:
$HtmlHelper.SubmitButton( "valueArg" )
Calling SubmitButton( "valueArg" )
results in:
<input type="submit" value="valueArg" />
| Parameter | Description |
|---|---|
| value | System.String for value attribute. |
SubmitButton(String value, IDictionary attributes) : String
Creates a submit button.
<input type="submit" value="valueArg" key1="value1" key2="value2" />
Example
This example shows how to use SubmitButton:
$HtmlHelper.SubmitButton( "valueArg", IDictionary )
Calling SubmitButton( "valueArg", IDictionary )
results in:
<input type="submit" value="valueArg" key1="value1" key2="value2" />
attributes is used to generate additional attributes for the label tag. System.Collections.IDictionary.Keys are used to name attributes. System.Collections.IDictionary.Values are used to assign those attributes values.
| Parameter | Description |
|---|---|
| value | System.String for value attribute. |
| attributes | Additional attributes for the input tag. |
Select(String name) : String
Creates opening select
tag.
<select name="nameArg" id="nameArg">
Example
This example shows how to use Select together with Castle.MonoRail.Framework.Helpers.HtmlHelper.EndSelect:
$HtmlHelper.Select( "nameArg" )
...
$HtmlHelper.EndSelect()
Calling Select( "nameArg" )
results in:
<select name="nameArg" id="nameArg">
| Parameter | Description |
|---|---|
| name | Value for name and id attributes. |
Select(String name, IDictionary attributes) : String
Creates opening select
tag.
<select name="nameArg" id="nameArg" key1="value1" key2="value2" >
Example
This example shows how to use Select together with Castle.MonoRail.Framework.Helpers.HtmlHelper.EndSelect:
$HtmlHelper.Select( "nameArg", IDictionary )
...
$HtmlHelper.EndSelect()
Calling Select( "nameArg", IDictionary )
results in:
<select name="nameArg" id="nameArg" key1="value1" key2="value2" >
attributes is used to generate additional attributes for the label tag. System.Collections.IDictionary.Keys are used to name attributes. System.Collections.IDictionary.Values are used to assign those attributes values.
| Parameter | Description |
|---|---|
| name | Value for name and id attributes. |
| attributes | Additional attributes for the select tag. |
EndSelect() : String
Creates a closing select tag.
Example
This example shows how to use Castle.MonoRail.Framework.Helpers.HtmlHelper.Select(System.String) together with EndSelect:
$HtmlHelper.Select( "nameArg" )
...
$HtmlHelper.EndSelect()
Calling EndSelect()
results in:
</select>
OptionGroup(String label) : String
TODO: Document this!
| Parameter | Description |
|---|---|
| label |
EndOptionGroup() : String
Missing summary
CreateOption(String text, Object value) : String
TODO: Document this!
| Parameter | Description |
|---|---|
| text | Missing documentation |
| value | Missing documentation |
CreateOption(String text, Object value, IDictionary htmlAttributes) : String
TODO: Document this!
Valid html attributes include: selected and disabled
| Parameter | Description |
|---|---|
| text | Missing documentation |
| value | Missing documentation |
| htmlAttributes | Missing documentation |
CreateOptionsFromPrimitiveArray(Array elems, String selected) : String
Creates option elements from System.Array. Marks the option that matches the selected
argument (if provided).
<option>0</option>
<option>1</option>
...
<option>5</option>
<option selected>selectedArg</option>
<option>object</option>
Example
This example shows how to use CreateOptionsFromPrimitiveArray:
$HtmlHelper.CreateOptionsFromPrimitiveArray( Array, "selectedArg" )
Calling CreateOptionsFromPrimitiveArray( Array, "selectedArg" )
results in:
<option>0</option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option selected>selectedArg</option> <option>object</option>
Elements in the array are converted to System.String using System.Text.StringBuilder.AppendFormat(System.String,System.Object).
| Parameter | Description |
|---|---|
| elems | Array of values for each option tag. |
| selected | Name of the option tag to mark selected. |
CreateOptionsFromArray(Array elems, String textProperty, String valueProperty) : String
Creates options elements from an System.Array
.
<option value="valueProp">textProp</option> <option value="0">textProp2</option> <option value="5">textProp3</option>
Example
This example shows how to use CreateOptions:
$HtmlHelper.CreateOptionsFromArray( ICollection, "textPropertyArg", "valuePropertyArg" )
Calling CreateOptionsFromArray( Array, "textPropertyArg", "valuePropertyArg", object )
with specific type objects results in:
<option value="valueProp">textProp</option> <option value="0">textProp2</option> <option value="5">textProp3</option>
Calling CreateOptionsFromArray( Array, "textPropertyArg", "valuePropertyArg", object )
with random type objects results in:
<option>0</option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>object</option> <option>MR.Logic.Controllers.HtmlHelperController+SampleClass</option>Notice that the last option was generated from an object of the type with the properties specified by textProperty and
There are two possible usages of the method depending on the types of System.Objects which can be present in elems:
CreateOptionsFromArray relies on Castle.MonoRail.Framework.Helpers.HtmlHelper.CreateOptions(System.Collections.ICollection,System.String,System.String) to generate all option tags.
| Parameter | Description |
|---|---|
| elems | Collection of objects each of which describes an option tag. |
| textProperty | Name of the elems objects property with the value for each option tag's text. |
| valueProperty | Name of the elems objects property with the value for each option tag's value attribute value. |
CreateOptionsFromArray(Array elems, String textProperty, String valueProperty, Object selectedValue) : String
Creates options elements from an System.Array
.
<option value="valueProp" selected>textProp</option> <option value="0">textProp2</option> <option value="5">textProp3</option>
Example
This example shows how to use CreateOptions:
$HtmlHelper.CreateOptionsFromArray( ICollection, "textPropertyArg", "valuePropertyArg", object )
Calling CreateOptionsFromArray( Array, "textPropertyArg", "valuePropertyArg", object )
with specific type objects results in:
<option value="valueProp" selected>textProp</option> <option value="0">textProp2</option> <option value="5">textProp3</option>
Calling CreateOptionsFromArray( Array, "textPropertyArg", "valuePropertyArg", object )
with random type objects results in:
<option>0</option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option selected>object</option> <option>MR.Logic.Controllers.HtmlHelperController+SampleClass</option>Notice that the last option was generated from an object of the type with the properties specified by textProperty and
There are two possible usages of the method depending on the types of System.Objects which can be present in elems:
CreateOptionsFromArray relies on Castle.MonoRail.Framework.Helpers.HtmlHelper.CreateOptions(System.Collections.ICollection,System.String,System.String) to generate all option tags.
| Parameter | Description |
|---|---|
| elems | Collection of objects each of which describes an option tag. |
| textProperty | Name of the elems objects property with the value for each option tag's text. |
| valueProperty | Name of the elems objects property with the value for each option tag's value attribute value. |
| selectedValue | System.Object indicating which option tag is to be marked with selected attribute. |
CreateOptions(ICollection elems, String textProperty, String valueProperty) : String
Creates options elements from an System.Collections.ICollection
.
<option value="valueProp">textProp</option> <option value="0">textProp2</option> <option value="5">textProp3</option>
Example
This example shows how to use CreateOptions:
$HtmlHelper.CreateOptions( ICollection, "textPropertyArg", "valuePropertyArg" )
Calling CreateOptions( ICollection, "textPropertyArg", "valuePropertyArg", object )
with specific type objects results in:
<option value="valueProp">textProp</option> <option value="0">textProp2</option> <option value="5">textProp3</option>
Calling CreateOptions( ICollection, "textPropertyArg", "valuePropertyArg", object )
with random type objects results in:
<option>0</option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>object</option> <option>MR.Logic.Controllers.HtmlHelperController+SampleClass</option>Notice that the last option was generated from an object of the type with the properties specified by textProperty and
There are two possible usages of the method depending on the types of System.Objects which can be present in elems:
| Parameter | Description |
|---|---|
| elems | Collection of objects each of which describes an option tag. |
| textProperty | Name of the elems objects property with the value for each option tag's text. |
| valueProperty | Name of the elems objects property with the value for each option tag's value attribute value. |
CreateOptions(ICollection elems, String textProperty, String valueProperty, Object selectedValue) : String
Creates options elements from an System.Collections.ICollection
.
<option value="valueProp" selected>textProp</option> <option value="0">textProp2</option> <option value="5">textProp3</option>
Example
This example shows how to use CreateOptions:
$HtmlHelper.CreateOptions( ICollection, "textPropertyArg", "valuePropertyArg", object )
Calling CreateOptions( ICollection, "textPropertyArg", "valuePropertyArg", object )
with specific type objects results in:
<option value="valueProp" selected>textProp</option> <option value="0">textProp2</option> <option value="5">textProp3</option>
Calling CreateOptions( ICollection, "textPropertyArg", "valuePropertyArg", object )
with random type objects results in:
<option>0</option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option selected>object</option> <option>MR.Logic.Controllers.HtmlHelperController+SampleClass</option>Notice that the last option was generated from an object of the type with the properties specified by textProperty and
There are two possible usages of the method depending on the types of System.Objects which can be present in elems:
| Parameter | Description |
|---|---|
| elems | Collection of objects each of which describes an option tag. |
| textProperty | Name of the elems objects property with the value for each option tag's text. |
| valueProperty | Name of the elems objects property with the value for each option tag's value attribute value. |
| selectedValue | System.Object indicating which option tag is to be marked with selected attribute. |
BuildUnorderedList(ICollection elements) : String
Builds an unordered ul list from supplied System.Collections.ICollection
.
<ul>
<li>0</li>
...
<li>object</li>
</ul>
Example
This example shows how to use BuildUnorderedList:
$HtmlHelper.BuildUnorderedList( ICollection )
Calling BuildUnorderedList( ICollection )
results in:
<ul> <li>0</li> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <li>object</li> </ul>
Items in elements are converted to string through System.Object.ToString.
| Parameter | Description |
|---|---|
| elements | Collection with items to use for the list generation. |
BuildUnorderedList(ICollection elements, String styleClass, String itemClass) : String
Builds an unordered ul list from supplied System.Collections.ICollection with ul and li
tags CSS class set to supplied attributes.
<ol class="styleClassArg"> <li class="itemClassArg">0</li> ... <li class="itemClassArg">object</li> </ol>
Example
This example shows how to use BuildOrderedList:
$HtmlHelper.BuildUnorderedList( ICollection, "styleClassArg", "itemClassArg" )
Calling BuildUnorderedList( ICollection, "styleClassArg", "itemClassArg" )
results in:
<ol class="styleClassArg"> <li class="itemClassArg">0</li> <li class="itemClassArg">1</li> <li class="itemClassArg">2</li> <li class="itemClassArg">3</li> <li class="itemClassArg">4</li> <li class="itemClassArg">5</li> <li class="itemClassArg">object</li> </ol>
Items in elements are converted to string through System.Object.ToString.
| Parameter | Description |
|---|---|
| elements | Collection with items to use for the list generation. |
| styleClass | CSS class name of the list ul tag. |
| itemClass | CSS class name of the list item li tag. |
BuildOrderedList(ICollection elements) : String
Builds an ordered ol list from supplied System.Collections.ICollection
.
<ol>
<li>0</li>
...
<li>object</li>
</ol>
Example
This example shows how to use BuildOrderedList:
$HtmlHelper.BuildOrderedList( ICollection )
Calling BuildOrderedList( ICollection )
results in:
<ol> <li>0</li> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <li>object</li> </ol>
Items in elements are converted to string through System.Object.ToString.
| Parameter | Description |
|---|---|
| elements | Collection with items to use for the list generation. |
BuildOrderedList(ICollection elements, String styleClass, String itemClass) : String
Builds an ordered ol list from supplied System.Collections.ICollection with ol and li
tags CSS class set to supplied attributes.
<ol class="styleClassArg"> <li class="itemClassArg">0</li> ... <li class="itemClassArg">object</li> </ol>
Example
This example shows how to use BuildOrderedList:
$HtmlHelper.BuildOrderedList( ICollection, "styleClassArg", "itemClassArg" )
Calling BuildOrderedList( ICollection, "styleClassArg", "itemClassArg" )
results in:
<ol class="styleClassArg"> <li class="itemClassArg">0</li> <li class="itemClassArg">1</li> <li class="itemClassArg">2</li> <li class="itemClassArg">3</li> <li class="itemClassArg">4</li> <li class="itemClassArg">5</li> <li class="itemClassArg">object</li> </ol>
Items in elements are converted to string through System.Object.ToString.
| Parameter | Description |
|---|---|
| elements | Collection with items to use for the list generation. |
| styleClass | CSS class name of the list ol tag. |
| itemClass | CSS class name of the list item li tag. |