DropDownList
DropDownList Example
Select a background color for days in the calendar.
|
|||||||||
週日 | 週一 | 週二 | 週三 | 週四 | 週五 | 週六 | |||
---|---|---|---|---|---|---|---|---|---|
31 | 1 | 2 | 3 | 4 | 5 | 6 | |||
7 | 8 | 9 | 10 | 11 | 12 | 13 | |||
14 | 15 | 16 | 17 | 18 | 19 | 20 | |||
21 | 22 | 23 | 24 | 25 | 26 | 27 | |||
28 | 29 | 30 | 1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
Background color: |
@inherits ControlComponent
<p>Select a background color for days in the calendar.</p>
<asp.Calendar @ref="this.calendar" ShowGridLines="true" ShowTitle="true" />
<br />
<table cellpadding="5">
<tr>
<td>
Background color:
</td>
</tr>
<tr>
<td>
<asp.DropDownList @ref="this.colorList"
AutoPostBack="true"
OnSelectedIndexChanged="this.Selection_Change">
<asp.ListItem Selected="true" Value="White">White</asp.ListItem>
<asp.ListItem Value="Silver">Silver</asp.ListItem>
<asp.ListItem Value="DarkGray">Dark Gray</asp.ListItem>
<asp.ListItem Value="Khaki">Khaki</asp.ListItem>
<asp.ListItem Value="DarkKhaki">Dark Khaki</asp.ListItem>
</asp.DropDownList>
</td>
</tr>
</table>
@code {
private Calendar calendar;
private DropDownList colorList;
protected void Selection_Change(object sender, EventArgs e)
{
// Set the background color for days in the Calendar control
// based on the value selected by the user from the
// DropDownList control.
calendar.DayStyle.BackColor =
System.Drawing.Color.FromName(colorList.SelectedItem.Value);
}
}
DropDownList Data Binding Example
Select a background color for days in the calendar.
|
|||||||||
週日 | 週一 | 週二 | 週三 | 週四 | 週五 | 週六 | |||
---|---|---|---|---|---|---|---|---|---|
31 | 1 | 2 | 3 | 4 | 5 | 6 | |||
7 | 8 | 9 | 10 | 11 | 12 | 13 | |||
14 | 15 | 16 | 17 | 18 | 19 | 20 | |||
21 | 22 | 23 | 24 | 25 | 26 | 27 | |||
28 | 29 | 30 | 1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
Background color: |
@inherits ControlComponent
@inject HttpClient Http
<p>Select a background color for days in the calendar.</p>
<asp.Calendar @ref="this.calendar" ShowGridLines="true" ShowTitle="true" />
<br />
<table cellpadding="5">
<tr>
<td>
Background color:
</td>
</tr>
<tr>
<td>
<asp.DropDownList @ref="this.colorList"
AutoPostBack="true" DataSourceID="FreeDataSource1"
DataTextField="ColorTextField"
DataValueField="ColorValueField"
OnSelectedIndexChanged="this.Selection_Change">
</asp.DropDownList>
<asp.FreeDataSource ID="FreeDataSource1" OnExecuteSelected="sender => this.colors" />
</td>
</tr>
</table>
@code {
private Color[] colors;
private Calendar calendar;
private DropDownList colorList;
protected override async Task OnInitializedAsync()
{
colors = await Http.GetFromJsonAsync<Color[]>("sample-data/colors.json");
}
protected void Selection_Change(object sender, EventArgs e)
{
// Set the background color for days in the Calendar control
// based on the value selected by the user from the
// DropDownList control.
calendar.DayStyle.BackColor =
System.Drawing.Color.FromName(colorList.SelectedItem.Value);
}
public class Color
{
public string ColorTextField { get; set; }
public string ColorValueField { get; set; }
}
}
DropDownList 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 | ||||||||||||||||||
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 | ||||||||||||||||||
SelectedValue | String | Parameter | ||||||||||||||||||
Style | String | Parameter | ||||||||||||||||||
TabIndex | Int16 | 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 | ||||||||||||||||||
|