aspx:FieldDropDown
This component is an HTML select element, used to view pick-list data types.
<aspx:FieldDropDown runat='server' value='{!Model.Status}'/>
If you bind a Pick-list Field to this control, the Pick-list values are automatically added and shown as options on this drop-down. It is also possible to add your option values through "Databind" properties or specify values explicitly, as shown below:
<aspx:FieldDropDown runat='server' value='{!Model.Status}'>
<items>
<asp:ListItem text='Item1' value='Value1' />
<asp:ListItem text='Item2' value='Value2' />
</items>
</aspx:FieldDropDown>
If you would like to bind a custom list as a Model to the control, do the following:
<aspx:FieldDropDown runat='server' DataSource='<%#Model.Contacts%>' DataTextField='Name' DataValueField='Id' value='{!Model.ContactId}'/>
If you would like to bind a custom list from the DataBag, do the following:
<aspx:FieldDropDown runat='server' DataSource='<%#DataBag.Contacts%>' DataTextField="Name" DataValueField="Id" value='{!Model.ContactId}'/>
| Property | Description |
|---|
| Id | The ID of the HTML element. |
| Value | Bind value containing the name of the object and the field to bind. |
| Label | Label of a field within the section. |
| Required | A Boolean value that specifies whether this inputField is a required field. If set to true, the user must specify a value for this field. If not selected, this value defaults to false. |
| Hint | A Text value that is shown to the user on the right side of the input component to assist the user. |
| HideLabel | A Boolean value that specifies whether this field's label should be visible or not. If set to false, the input component spans across the entire row. |
| Enabled | A boolean that determines whether to show the field or not. |
| PlaceHolder | Text is shown inside the input component as a watermark. |
| Width | The width of the input component. The value can be provided in pixels or percentages. |
| DataSource | A List or an Array that will populate the contents of the dropdown. |
| DataTextField | A text field used in conjunction with DataSouce. Thisdefines which field should be used to display in the select dropdown. |
| DataValueField | A text field used in conjunction with DataSource. This defines what field should be used to populate the value field of the select statement. |
| IsNullable | A boolean that defines whether the field can be null. |
| HelpText | A text value that displays a small bubble next to the field label. When hovered over, the help text will appear. |
| ReadOnly | A boolean value that determines whether this field can be set or not. |
| | |