BulletedList
BulletedList Click Example
Click on an item in the list to raise the Click event.
@inherits ControlComponent
<p>Click on an item in the list to raise the Click event.</p>
<asp.BulletedList BulletStyle="BulletStyle.Disc" DisplayMode="BulletedListDisplayMode.LinkButton"
OnClick="this.BulletedList_Click">
<asp.ListItem Value="http://www.cohowinery.com">Coho Winery</asp.ListItem>
<asp.ListItem Value="http://www.contoso.com">Contoso, Ltd.</asp.ListItem>
<asp.ListItem Value="http://www.tailspintoys.com">Tailspin Toys</asp.ListItem>
</asp.BulletedList>
<asp.Label @ref="this.message" FontSize="12" Width="168px" FontBold="true" />
@code {
private Label message;
protected void BulletedList_Click(object sender, BulletedListEventArgs e)
{
// Change the message displayed in the label based on the index
// of the list item that was clicked.
switch (e.Index)
{
case 0:
message.Text = "You clicked list item 1.";
break;
case 1:
message.Text = "You clicked list item 2.";
break;
case 2:
message.Text = "You clicked list item 3.";
break;
default:
throw new Exception("You did not click a valid list item.");
}
}
}
BulletedList Class Data Binding Example
@inherits ControlComponent
@inject HttpClient Http
<p>Click on an item in the list.</p>
<asp.BulletedList BulletStyle="BulletStyle.Disc" DisplayMode="BulletedListDisplayMode.LinkButton"
DataTextField="Summary" DataSourceID="FreeDataSource1"
OnClick="this.BulletedList_Click">
</asp.BulletedList>
<asp.FreeDataSource ID="FreeDataSource1" OnExecuteSelected="sender => this.forecasts" />
<asp.Label @ref="this.message" FontSize="12" Width="168px" FontBold="true" />
@code {
private WeatherForecast[] forecasts;
private Label message;
protected override async Task OnInitializedAsync()
{
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");
}
protected void BulletedList_Click(object sender, BulletedListEventArgs e)
{
// Change the message displayed in the label based on the index
// of the list item that was clicked.
switch (e.Index)
{
case 0:
message.Text = "Product 1 was clicked";
break;
case 1:
message.Text = "Product 2 was clicked";
break;
case 2:
message.Text = "Product 3 was clicked";
break;
case 3:
message.Text = "Product 4 was clicked";
break;
case 4:
message.Text = "Product 5 was clicked";
break;
default:
throw new Exception("You must click a valid list item.");
}
}
public class WeatherForecast
{
public DateTime Date { get; set; }
public int TemperatureC { get; set; }
public string Summary { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}
}
BulletedList 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 | ||||||||||||||||||
| BulletImageUrl | String | Parameter | ||||||||||||||||||
| BulletStyle | BulletStyle | 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 | ||||||||||||||||||
| DisplayMode | BulletedListDisplayMode | Parameter | ||||||||||||||||||
| Enabled | Boolean | Parameter | ||||||||||||||||||
| FirstBulletNumber | Int32 | 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 | ||||||||||||||||||
| RenderWhenDataEmpty | Boolean | Parameter | ||||||||||||||||||
| SelectedValue | String | Parameter | ||||||||||||||||||
| Style | String | Parameter | ||||||||||||||||||
| TabIndex | Int16 | Parameter | ||||||||||||||||||
| Target | String | Parameter | ||||||||||||||||||
| ToolTip | String | Parameter | ||||||||||||||||||
| ValidationGroup | String | Parameter | ||||||||||||||||||
| Visible | Boolean | Parameter | ||||||||||||||||||
| Width | String | Parameter | ||||||||||||||||||
| OnCallingDataMethods | CallingDataMethodsEventHandler | Event | ||||||||||||||||||
| OnClick | BulletedListEventHandler | 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 | ||||||||||||||||||
|
||||||||||||||||||||