|
The list of elements of the select type is shown in the table below.
Element Type |
Source Content Representation |
Web Controls |
checkbox |
<input id="check1" type="checkbox" name="check1" onclick="javascript:" /> |
<asp:CheckBox id="check1"
Text="Same as home phone" TextAlign="Right"
AutoPostBack="True" OnCheckedChanged="Check"
runat="server" /> |
checkboxGroup |
Default: render list of checkbox in a table, with each element in its own row. |
<asp:CheckBoxList id="check1" AutoPostBack="True"
TextAlign="Right" OnSelectedIndexChanged="Check"
runat="server"/> |
option |
<option value="Item 1">Item 1 </option> |
<asp:ListItem>Item 1 </asp:ListItem> |
options |
Bindings for options are reflected directly on List controls like - asp:CheckboxList, asp:DropDownList, and
asp:ListBox |
Bindings for options are reflected directly on List controls like - asp:CheckboxList, asp:DropDownList, and
asp:ListBox |
radio |
<input id="red" type="radio" name="colors" value="red" checked="checked" /><label for="red">Red</label> |
<asp:RadioButton id="red" Text="Red" Checked="True"
GroupName="colors" runat="server"/> |
radioGroup |
Default: render list of radio buttons in a table, with each element in its own row. |
<asp:RadioButtonList id="radiolist1" runat="server">
<asp:ListItem selected="true">Item 1 </asp:ListItem>
<asp:ListItem>Item 2 </asp:ListItem>
<asp:ListItem>Item 3 </asp:ListItem>
<asp:ListItem>Item 4 </asp:ListItem>
</asp:RadioButtonList> |
select (dropdown) |
<select name="drop1" id="drop1">
<option value="Item 1">Item 1 </option>
<option value="Item 2">Item 2 </option>
</select>
|
<asp:DropDownList id="drop1" runat="server">
<asp:ListItem>Item 1 </asp:ListItem>
<asp:ListItem>Item 2 </asp:ListItem>
</asp:DropDownList> |
Select (list box) |
<select size="3" name="drop1" id="drop1">
<option value="Item 1">Item 1 </option>
<option value="Item 2">Item 2 </option>
</select>
|
<asp:ListBox id="drop1" rows="3" runat="server">
<asp:ListItem>Item 1 </asp:ListItem>
<asp:ListItem>Item 2 </asp:ListItem>
</asp:DropDownList> |
The select category elements are basically input elements that allow selection from a predetermined list rather than user entry.
As such they share the same basics as the input type. Please refer to the input type for the basics.
Where the select items differ is that they would be associated with options or option type element as shown below.
ELEMENT DESCRIPTORS |
id |
caption |
type |
value |
component-id |
conversion-type |
validators |
formatter |
required |
visible |
enabled |
group-id |
spec-scope |
| CustomerID |
Customer |
select |
{!.CustomerID} |
|
|
|
|
|
|
|
|
|
| CustomerID |
{CustomersDS[].CustomerName} |
options |
{CustomersDS[].CustomerID} |
|
|
|
|
|
|
|
|
|
Example implementation is shown below.
<asp:DropdownList id="CustomerID" runat="server"
DataSourceID="CustomersDS"
DataTextField="CustomerName"
DataValueField ="CustomerID" />
The options element properties are reflected directly on the properties of the select type elements, on the ASP.NET platform. This subtle difference should be noted. In HTML options elements are nested in the select element, and not its property. This is the way it is also modeled in dWebSpec and most platforms.
The mapping of the options to the attribute of the select controls is shown below.
Element Descriptor Attributes |
Property |
Description |
Part of Caption/value entries |
DataSourceID |
The DataSourceID is derived from the object part of the {object,attribute} binding for the caption and value. |
caption |
DataTextField |
The DataTextField is derived from the attribute part of the {object,attribute} binding for the caption |
value |
DataValueField |
The DataValueField is derived from the attribute part of the {object.attribute} binding for the value |
The list item specification and mapping is shown above, the table below shows the full set of attributes shared by list controls and their mappings. These mappings are to the element descriptor attributes, except otherwise stated.
Control Property |
Descriptor Attribute |
Description |
AutoPostBack |
Event descriptor call type: autopostback |
Specifies whether the form should be posted immediately after the index of the selected item has changed or not |
CausesValidation |
Event descriptor call type: immediate (converse) |
Specifies whether or not a page is validated when an item in a list control is clicked on. |
DataSourceID |
Part of caption/value entries for associated options element |
The data source portion of caption or value specification. Implication is that both entries must have the same data source. |
DataTextField |
caption associated options element |
A field in the data source to be displayed in the drop-down list |
DataTextFormatString |
formatter |
Formatting string used to specify how to display list data |
DataValueField |
Value associated options element |
A field in the data source that specifies the value of each selectable item in the drop-down list |
SelectedValue |
value |
The value of the selected item in a list |
Option
Unlike the implementation of the options type element that is merged with that of the associated select element, the implementation of the option type is separate.
An example specification would appear as follows.
ELEMENT DESCRIPTORS |
id |
caption |
type |
value |
component-id |
conversion-type |
validators |
formatter |
required |
visible |
enabled |
group-id |
spec-scope |
| CustomerID |
Customer |
select |
{!.CustomerID} |
|
|
|
|
|
|
|
|
|
| CustomerID |
{!.CustomerName} |
option |
{!.CustomerID} |
|
|
|
|
|
|
|
|
|
This would be implemented as:
<asp:ListItem Text="{#Eval('CustopmerName'}" Value="{#Eval('CustopmerID'}" />
The dynamically populated list items would show up in the descriptors as shown in the example above. However, there could be static options in the source content; example is shown below.
<option Value="" >Please select an item</option>
The implementation for these would be as shown below.
<asp:ListItem Value="">Please select an item</asp:ListItem>
Other List Items Implementation Attributes.
Most of the standard elements have direct correspondence to HTML elements. It is the elements of the component category that do not have direct correspondence to single HTML element. They could include multiple elements, layout and segments.
In the selection category, the checkboxGroup and radioGroup are also of the component category; they do not have correspondence to an HTML element, furthermore they could include template or layout code.
Notwithstanding, their implementation on most platform could be simplified into simple repetition of single element (e.g. checkbox), plus additional attribute to indicate horizontal or vertical layout. ASP.NET provided for these additional parameters, as highlighted in the table below.
Control Layout Parameter |
Options |
RepeatLayout |
Table: tabular rows or columns
Flow: inline left to right, flow to next line |
RepeatDirection |
Horizontal (rows)
Vertical (columns) |
RepeatColumn |
Maximum columns when RepeatLayout is Table. |
CellPadding, CellSpacing, TextAlign |
Pass through for table layout. |
|
|
|