Home

Castle Stronghold

Table of contents

HtmlHelper API Document

Provides usefull common methods to generate HTML tags.

Quick Note

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()
Quick Note

Calling FieldSet( "legendArg" )

results in:

<fieldset><legend>legendArg</legend>

ParameterDescription
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()
Quick Note

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()
Quick Note

Calling Form( "actionArg" )

results in:

<form method="post" action="actionArg">

ParameterDescription
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()
Quick Note

Calling Form( "actionArg", "idArg", "methodArg" )

results in:

<form method="methodArg" action="actionArg" id="idArg">

ParameterDescription
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()
Quick Note

Calling Form( "actionArg", "idArg", "methodArg", "onSubmitArg" )

results in:

<form method="methodArg" action="actionArg" id="idArg" onsubmit="onSubmitArg">

ParameterDescription
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">

ParameterDescription
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()
Quick Note

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" )
Quick Note

Calling Link( "something.html", "to something" )

results in:

<a href="something.html">something</a>

ParameterDescription
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") )
Quick Note

Calling Link( "something.html", "to something", $DictHelper.CreateDict("class=mylinkclass") )

results in:

<a href="something.html" class="mylinkclass">something</a>

ParameterDescription
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" )
Quick Note

Calling LinkTo( "nameArg", "actionArg" )

results in:

<a href="/websiter/currentController/actionArg.rails">nameArg</a>

ParameterDescription
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" )
Quick Note

Calling LinkTo( "nameArg", "controllerArg", "actionArg" )

results in:

<a href="/website/controllerArg/actionArg.rails">nameArg</a>

ParameterDescription
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 )
Quick Note

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.

ParameterDescription
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") )
Quick Note

Calling LinkToAttributed( "nameArg", "controllerArg", "actionArg", IDictionary )

results in:

<a href="/website/controllerArg/actionArg.rails">nameArg</a>

ParameterDescription
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") )
Quick Note

Calling LinkToAttributed( "nameArg", "controllerArg", "actionArg", IDictionary )

results in:

<a href="/website/controllerArg/actionArg.rails">nameArg</a>

ParameterDescription
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" )
Quick Note

Calling MapToVirtual( "targetArg" )

results in:

/website/targetArg

ParameterDescription
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" )
Quick Note

Calling LabelFor( "forIdArg", "labelArg" )

results in:

<label  for="forIdArg">labelArg</label>

ParameterDescription
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 )
Quick Note

Calling LabelFor( "forIdArg", "labelArg", IDictionary )

results in:

<label key5="value5" key4="value4" key1="value1" key3="value3" key2="value2"  for="forIdArg">labelArg</label>

ParameterDescription
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 ) )
Quick Note

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.

ParameterDescription
name Name to use with name and id arguments of the select tag.
valueSystem.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 )
Quick Note

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.

ParameterDescription
name Name to use with name and id arguments of the select tag.
valueSystem.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." )
Quick Note

Calling TextArea( "nameArg", 10, 10, "valueArg" )

results in:

<textarea id="nameArg" name="nameArg" cols="10" rows="10">valueArg</textarea>

ParameterDescription
name Value for name and id attributes.
colscols attribute value.
rowsrows 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" )
Quick Note

Calling InputButton( "valueArg" )

results in:

<input type="button" name="valueArg" value="valueArg" />

ParameterDescription
valueSystem.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" />

ParameterDescription
name Value for name and id attributes.
valueSystem.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" />

ParameterDescription
name Value for name and id attributes.
valueSystem.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" />

Quick Note

Calling InputCheckbox( "name", "1" )

results in:

<input type="checkbox" name="name" id="name" value="1" />

ParameterDescription
name Value for name and id attributes.
valueSystem.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" />

ParameterDescription
name Value for name and id attributes.
valueSystem.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" />

ParameterDescription
name Value for name and id attributes.
valueSystem.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" />

Quick Note

Calling InputRadio( "name", "1" )

results in:

<input type="radio" name="name" value="1" />

ParameterDescription
name Value for name attribute.
valueSystem.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" />

ParameterDescription
name Value for name attribute.
valueSystem.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" />

Quick Note

Calling InputFile( "name" )

results in:

<input type="file" name="name" />

ParameterDescription
name Value for name attribute.

InputFile(String name, IDictionary attributes) : String

Creates an input element of the file type.


<input type="file" name="nameArg" />

ParameterDescription
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" )
Quick Note

Calling InputText( "nameArg", "valueArg" )

results in:

<input type="text" name="nameArg" id="nameArg" value="valueArg" />

ParameterDescription
name Value for name and id attributes.
valueSystem.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 )
Quick Note

Calling InputText( "nameArg", "valueArg", 10, 10 )

results in:

<input type="text" name="nameArg" id="nameArg" value="valueArg" size="10" maxlength="10" />

ParameterDescription
name Value for name and id attributes.
valueSystem.String for value attribute.
sizesize attribute value.
maxlengthmaxlength 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 )
Quick Note

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.

ParameterDescription
name Value for name and id attributes.
valueSystem.String for value attribute.
sizesize attribute value.
maxlengthmaxlength 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" )
Quick Note

Calling InputText( "nameArg", "valueArg", "idArg" )

results in:

<input type="text" name="nameArg" id="idArg" value="valueArg" />

ParameterDescription
namename attribute value.
valueSystem.String for value attribute.
idid 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" />

ParameterDescription
name Missing documentation
value Missing documentation
attributes Missing documentation

InputPassword(String name) : String

Creates an input element of password type

ParameterDescription
name Missing documentation

InputPassword(String name, String value) : String

Creates an input element of password type

ParameterDescription
name Missing documentation
value Missing documentation

InputPassword(String name, String value, IDictionary attributes) : String

Creates an input element of password type

ParameterDescription
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" )
Quick Note

Calling InputHidden( "nameArg", "valueArg" )

results in:

<input type="hidden" name="nameArg" id="nameArg" value="valueArg" />

ParameterDescription
name Value for name and id attributes.
valueSystem.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  )
Quick Note

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.

ParameterDescription
name Value for name and id attributes.
valueSystem.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" )
Quick Note

Calling SubmitButton( "valueArg" )

results in:

<input type="submit" value="valueArg"  />

ParameterDescription
valueSystem.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 )
Quick Note

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.

ParameterDescription
valueSystem.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()
Quick Note

Calling Select( "nameArg" )

results in:

<select name="nameArg" id="nameArg">

ParameterDescription
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()
Quick Note

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.

ParameterDescription
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()
Quick Note

Calling EndSelect()

results in:

</select>

OptionGroup(String label) : String

TODO: Document this!

ParameterDescription
label

EndOptionGroup() : String

Missing summary

CreateOption(String text, Object value) : String

TODO: Document this!

ParameterDescription
text Missing documentation
value Missing documentation

CreateOption(String text, Object value, IDictionary htmlAttributes) : String

TODO: Document this!

Quick Note

Valid html attributes include: selected and disabled

ParameterDescription
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" )
Quick Note

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).

ParameterDescription
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" )
Quick Note

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 , but the method is already in the mode of working with random type objects. Explanation bellow describes two different modes of working with the method.

There are two possible usages of the method depending on the types of System.Objects which can be present in elems: Random type objectsArray is full of random type objects. Properties specified by textProperty and aren't used. Instead value argument is ommited and System.Object.ToString is invoked on each item in elems to retrieve text for an option tag. Single type objectsArray is objects of one time. In this case textProperty and valueProperty can specify the names of the properties of that type to use for option tags generation. You cannot mix random type objects and specific type objects. CreateOptionsFromArray is looking at the first item in the elems collection to get System.Reflection.MethodInfo to access specified properties. If usage is mixed either an unexpected exception will be thrown or options will have unexpected strings.

CreateOptionsFromArray relies on Castle.MonoRail.Framework.Helpers.HtmlHelper.CreateOptions(System.Collections.ICollection,System.String,System.String) to generate all option tags.

ParameterDescription
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 )
Quick Note

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 , but the method is already in the mode of working with random type objects. Explanation bellow describes two different modes of working with the method.

There are two possible usages of the method depending on the types of System.Objects which can be present in elems: Random type objectsArray is full of random type objects. Properties specified by textProperty and aren't used. Instead value argument is ommited and System.Object.ToString is invoked on each item in elems to retrieve text for an option tag. Single type objectsArray is objects of one time. In this case textProperty and valueProperty can specify the names of the properties of that type to use for option tags generation. You cannot mix random type objects and specific type objects. CreateOptionsFromArray is looking at the first item in the elems collection to get System.Reflection.MethodInfo to access specified properties. If usage is mixed either an unexpected exception will be thrown or options will have unexpected strings.

CreateOptionsFromArray relies on Castle.MonoRail.Framework.Helpers.HtmlHelper.CreateOptions(System.Collections.ICollection,System.String,System.String) to generate all option tags.

ParameterDescription
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.
selectedValueSystem.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" )
Quick Note

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 , but the method is already in the mode of working with random type objects. Explanation bellow describes two different modes of working with the method.

There are two possible usages of the method depending on the types of System.Objects which can be present in elems: Random type objectsArray is full of random type objects. Properties specified by textProperty and aren't used. Instead value argument is ommited and System.Object.ToString is invoked on each item in elems to retrieve text for an option tag. Single type objectsArray is objects of one time. In this case textProperty and valueProperty can specify the names of the properties of that type to use for option tags generation. You cannot mix random type objects and specific type objects. CreateOptions is looking at the first item in the elems collection to get System.Reflection.MethodInfo to access specified properties. If usage is mixed either an unexpected exception will be thrown or options will have unexpected strings.

ParameterDescription
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 )
Quick Note

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 , but the method is already in the mode of working with random type objects. Explanation bellow describes two different modes of working with the method.

There are two possible usages of the method depending on the types of System.Objects which can be present in elems: Random type objectsArray is full of random type objects. Properties specified by textProperty and aren't used. Instead value argument is ommited and System.Object.ToString is invoked on each item in elems to retrieve text for an option tag. Single type objectsArray is objects of one time. In this case textProperty and valueProperty can specify the names of the properties of that type to use for option tags generation. You cannot mix random type objects and specific type objects. CreateOptions is looking at the first item in the elems collection to get System.Reflection.MethodInfo to access specified properties. If usage is mixed either an unexpected exception will be thrown or options will have unexpected strings.

ParameterDescription
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.
selectedValueSystem.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 )
Quick Note

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.

ParameterDescription
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" )
Quick Note

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.

ParameterDescription
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 )
Quick Note

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.

ParameterDescription
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" )
Quick Note

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.

ParameterDescription
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.

Google
Search WWW Search castleproject.org