Category List & Category Select Helpers

Last Updated 4/4/2016
Get a list of category items or a select list of a category

CategoryList and CategorySelect accept mostly the same parameters.  The difference of the two is that the default template for the CategoryList is a list and the CategorySelect returns a select element. The CategorySelect also has the name parameter to give a name value to the select element.

Parameters

tableId
Required. Specify Content or Contacts depending on the view you are using

viewId
Required. The view id of the view containing the category you want to get

fieldId
Required. This is the field that contains the category

template
CategoryList only. Optional. A Razor template; specify the HTML for the output.  To build the template you will need to access the following item - an EngineRecordList Each EngineRecord in item has
  • Id
  • Label
  • Abbrev
  • BackColor
count
Optional. Number of items to return. If no value is specified up to 500 items will be returned

query
Optional.  Where label like query

name
CategorySelect only. Required. Sets the value for the name attribute of the select

@BRT.CategoryList()

Example

Default Template
 <ul>
    @foreach(EngineRecord record in item){
        <li>@record.GetString("Label")</li>
    }
</ul>

@BRT.CategorySelect()

Example

Returns

 <select name="name">
    <option value=""></option>
    @foreach(EngineRecord record in item){
        <option>@record.GetString("Label")</option>
    }
</select>


 

Article Topics

For Developers

Want to learn more?

Call 800-924-5220 or

Schedule a demo