ComboBox
ComboBox Example
@inherits ControlComponent
<asp.ComboBox @ref="this.comboBox">
<asp.ListItem>Chocolate</asp.ListItem>
<asp.ListItem>Coconut</asp.ListItem>
<asp.ListItem>Mint</asp.ListItem>
<asp.ListItem>Strawberry</asp.ListItem>
<asp.ListItem>Vanilla</asp.ListItem>
</asp.ComboBox>
<br />
<br />
<asp.Button Text="Submit"
OnClick="this.SubmitBtn_Click" />
<asp.Label @ref="this.label" />
@code {
private ComboBox comboBox;
private Label label;
protected void SubmitBtn_Click(object sender, EventArgs e)
{
label.Text = "You chose: " + comboBox.Text;
}
}
ComboBox Data Binding Example
@using System.Collections
@inherits ControlComponent
<asp.ComboBox @ref="this.comboBox"
DataSourceID="FreeDataSource1">
</asp.ComboBox>
<asp.FreeDataSource ID="FreeDataSource1" OnExecuteSelected="sender => this.CreateDataSource()" />
<br />
<br />
<asp.Button Text="Submit"
OnClick="this.SubmitBtn_Click" />
<asp.Label @ref="this.label" />
@code {
private ComboBox comboBox;
private Label label;
protected ICollection CreateDataSource()
{
ArrayList values = new ArrayList();
values.Add("Chocolate");
values.Add("Coconut");
values.Add("Mint");
values.Add("Strawberry");
values.Add("Vanilla");
return values;
}
protected void SubmitBtn_Click(object sender, EventArgs e)
{
label.Text = "You chose: " + comboBox.Text;
}
}
ComboBox Metadata
| Name | Type | Kind | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| AccessKey | String | Parameter | ||||||||||||||||||
| AppendDataBoundItems | Boolean | Parameter | ||||||||||||||||||
| Attributes | IReadOnlyDictionary | Parameter | ||||||||||||||||||
| AutoPostBack | Boolean | Parameter | ||||||||||||||||||
| BackColor | String | Parameter | ||||||||||||||||||
| BorderColor | String | Parameter | ||||||||||||||||||
| BorderStyle | BorderStyle | Parameter | ||||||||||||||||||
| BorderWidth | String | Parameter | ||||||||||||||||||
| CausesValidation | Boolean | Parameter | ||||||||||||||||||
| ClientIDMode | ClientIDMode | Parameter | ||||||||||||||||||
| Columns | Int32 | Parameter | ||||||||||||||||||
| CssClass | String | Parameter | ||||||||||||||||||
| DataMember | String | Parameter | ||||||||||||||||||
| DataSourceID | String | Parameter | ||||||||||||||||||
| DataGroupField | String | Parameter | ||||||||||||||||||
| DataGroupFormatString | String | Parameter | ||||||||||||||||||
| DataTextField | String | Parameter | ||||||||||||||||||
| DataTextFormatString | String | Parameter | ||||||||||||||||||
| DataValueField | String | Parameter | ||||||||||||||||||
| Enabled | Boolean | Parameter | ||||||||||||||||||
| FontBold | Boolean | Parameter | ||||||||||||||||||
| FontItalic | Boolean | Parameter | ||||||||||||||||||
| FontNames | String | Parameter | ||||||||||||||||||
| FontOverline | Boolean | Parameter | ||||||||||||||||||
| FontSize | String | Parameter | ||||||||||||||||||
| FontStrikeout | Boolean | Parameter | ||||||||||||||||||
| FontUnderline | Boolean | Parameter | ||||||||||||||||||
| ForeColor | String | Parameter | ||||||||||||||||||
| Height | String | Parameter | ||||||||||||||||||
| ID | String | Parameter | ||||||||||||||||||
| MaxLength | Int32 | Parameter | ||||||||||||||||||
| ReadOnly | Boolean | Parameter | ||||||||||||||||||
| SelectedValue | String | Parameter | ||||||||||||||||||
| Style | String | Parameter | ||||||||||||||||||
| TabIndex | Int16 | Parameter | ||||||||||||||||||
| Text | String | Parameter | ||||||||||||||||||
| ToolTip | String | Parameter | ||||||||||||||||||
| ValidationGroup | String | Parameter | ||||||||||||||||||
| Visible | Boolean | Parameter | ||||||||||||||||||
| Width | String | Parameter | ||||||||||||||||||
| OnCallingDataMethods | CallingDataMethodsEventHandler | Event | ||||||||||||||||||
| OnCreatingModelDataSource | CreatingModelDataSourceEventHandler | Event | ||||||||||||||||||
| OnDataBinding | EventHandler | Event | ||||||||||||||||||
| OnDataBound | EventHandler | Event | ||||||||||||||||||
| OnDisposed | EventHandler | Event | ||||||||||||||||||
| OnInit | EventHandler | Event | ||||||||||||||||||
| OnLoad | EventHandler | Event | ||||||||||||||||||
| OnPreRender | EventHandler | Event | ||||||||||||||||||
| OnSelectedIndexChanged | EventHandler | Event | ||||||||||||||||||
| OnTextChanged | EventHandler | Event | ||||||||||||||||||
| OnUnload | EventHandler | Event | ||||||||||||||||||
| ListItem | asp.ListItem | InnerProperty | ||||||||||||||||||
|
||||||||||||||||||||