@BRT.CategorySelect()

Creates an HTML <Select> element based on options in a category field

@BRT.CategorySelect() creates an HTML <select> element.  The label value of each EngineRecord becomes an <option>.

This example:

@BRT.CategorySelect(tableId:"Content",viewId:"BlogPosts, fieldId"Topic", name:"Topic")

Returns:
<select name="Topic"> 
    <option value=""></option>
    @foreach(EngineRecord record in item) {
        <option>@record.GetString("Label")</option>
    }
</select>
Required Parameters
fieldID: Designates the Id of field
Example: fieldId:"Topic"
This parameter takes a single string argument - the Id value of the target field.
name: Sets the value for the name attribute of the select element
Example: name:"authorselect"
This parameter sets the name attribute of an HTML <select> element created by a Helper.
tableId: Names the base table to be targeted by the Helper, almost always: "Content" or "Contacts"
Example: tableId:"Content"
The tableId: parameter is used to name the base table that contains records to be retrieved by the Helper.  This is most commonly the "Content" or "Contacts" tables.
Less frequently used tableId values are:
  • tableId: "Users"
  • tableId: "RegForms"
  • tableId: "Emails"
  • tableId: "EmailNewsletter"
  • tableId: "EmailArchives"
viewId: Indicates the View which contains the record set to be targeted by the Helper
Example: viewId:"BlogPosts"
The viewID: parameter indicates the View targeted by the Helper. The View can be either visible or invisible to users in the Web Console.
Optional Parameters
condition: Adds a condition to filter records retrieved
Example: condition: (String.IsNullOrEmpty(Request.QueryString["topic"])?null:ConditionMeta.Parse("[Topic.Label]='" + Request.QueryString["topic"] + "'"))
The condition: parameter applies a search or filter condition to limit the EngineRecords retrieved from View named in the Helper's viewId: template.
count: Number of EngineRecords to return - starting with record [0].
Example: count:4
If this parameter is not used the Helper will retrieve up to 500 records.
This parameter takes a numeric value: x and retrieves the first x EngineRecords.
Note that:
  1. the first EngineRecord is number [0].  To return the first 5 EngineRecords use: count:4.
  2. most parameters take string arguments which require quotes.  This parameter arguments are strings and therefor enclosed in quotes.  This parameter takes an integer - no quotes please.
query: Provides criteria for a "Like" query on the Record Label
Example: query: "rooms"
This parameter takes a string value to form a simple Like query on the EngineRecord label value.  Wildcard characters normally allowed in Like criteria may not be used.
For example, the following Helper:
@BRT.CategoryList(tableId:"Contacts", viewId:"Facilities", fieldId:"Facility Type" ,query:"rooms" )
retrieves categories from the Facility Type Field defined in the Facilities View.  The results will include Conference Rooms, Meeting Rooms, and  Classrooms, but not Cafeterias or Reception Areas (or other categories without 'rooms' in the category label.