Creates an HTML Listbox. The listbox can be populated from a data source of a cursor, array or collection and by binding an evaluated expression for text and value displays of each list item.s
HtmlListBox(lcName,lcSelectedValue,lcDataSource, lcDataValueField, lcDataTextField, lcAttributes, lcInitialText, lcInitialValue)
Html string for a listbox
The name/id of the listbox
lcSelectedValue The selected value for the listbox.
On a Postback operation lcSelectedValue is automatically read from Request.Form() if available
You can override this behavior, and always force the value to be used by postfixing with ":FORCED" to the end of the value string (ie: TRANSFORM(lnSelectedPk) + ":FORCED").
The data source. Can be:
* Table/Cursor Alias
* One or two dimensional array
Two dimensional array should be value and text respectively. One dimensional can be either the single value or an object. If an object lcDataValueField and lcDataTextField are applied against the item (ie. Company or Address.Street will resolve to loItem.Company, loItem.Address.Street).
Collection can contain an object. Treated like object with array above.
An expression that is used for the Value fields in each list item.
lcDataTextField An expression that is used for the content in each list item. If not specified the same value as lcDataValueField is used.
Any extra HTML attributes you want to use on the list.
Determines the first item displayed in the list for something like "--- Please select ---". If specified the value for the first item is an empty string.
The value for that first injected item.
<%= HtmlListBox("lstCustomers","","TT_Cust","Trim(Company)",; "Company + [(] + Careof + [)]","","--- Select a Company") %> <!-- Always explicitly assign lnSelectedPk --> <%= HtmlListBox("lstCustomers",TRANS(lnSelectedPk) + ":FORCED","TT_Cust","Trim(Company)",; "Company + [(] + Careof + [)]","","--- Select a Company") %>
See also:Class wwHtmlHelpers
Comment or report problem with topic