当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > Web服务器控件:BulletedList控件

ASP.NET
LinQ学习之旅 从整型数组中找出偶数
解析:如何在 ASP.NET 中下载文件
无废话C#设计模式之九:Proxy
Asp.net中实现从弹出窗口中选择值
.Net中给TreeView控件的节点赋id值
ASP.NET 清除 HTML 标记函数
C#之 VS2008 之 Extension Methods
通过 C# 简化 APM
.Net调用Java webservice访问被拒绝解决方案
C#学习之类的访问修饰符
ASP.NET AJAX中的异步Web Services调用
.Net中生成二维的表格的代码
C#中的两个+(plus)操作符解析
Asp.net 2.0的TreeView客户端个性化控制
直接访问WebBrowser控件中的HTML源码
ASP.NET AJAX中的非同步PageMethod调用
利用C#实现分布式数据库查询
Web Services开发体会和在项目中的教训
开发学习之.Net中PE文件的结构
用C#实现启动另一程序的方法

ASP.NET 中的 Web服务器控件:BulletedList控件


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-28   浏览: 75 ::
收藏到网摘: n/a

阅读此文请先查看软晨学习网的:ASP.NET入门教程:Web服务器控件,简单讲述了Web服务器控件的使用方法。

定义和用法

BulletedList 能够以项目符号的格式来创建列表。创建一个控件,该控件以项目符号格式生成项列表

BulletedList 控件中的每个项目都由 ListItem 元素来定义!

注释:它是 ASP.NET 2.0 中的新类。

属性

属性 描述 .NET
BulletImageUrl

规定定制的列表项目图形符号的 URL。

在 "BulletStyle" 为 "CustomImage" 时使用。

2.0
BulletStyle 规定项目符号列表的样式。 2.0
DisplayMode 规定被显示的列表的类型。 2.0
FirstBulletNumber 规定在有序列表中列表项目的起始数字。 2.0
runat 必需。规定此控件是服务器控件。必须设置为 "server"。 1.0
Target 规定在何处打开目标 URL。 2.0

ListControl 标准属性

AppendDataBoundItems, AutoPostBack, CausesValidation, DataTextField,
DataTextFormatString, DataValueField, Items, runat, SelectedIndex, SelectedItem,
SelectedValue, TagKey, Text, ValidationGroup, OnSelectedIndexChanged

ListControl 控件包括列表控件的所有基本功能。继承自此控件的控件包括:CheckBoxList, DropDownList, ListBox 以及 RadioButtonList 控件。

Web 控件标准属性

AccessKey, Attributes, BackColor, BorderColor, BorderStyle, BorderWidth,
CssClass, Enabled, Font, EnableTheming, ForeColor, Height, IsEnabled,
SkinID, Style, TabIndex, ToolTip, Width

控件标准属性

AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls,
EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site,
TemplateControl, TemplateSourceDirectory, UniqueID, Visible

语法

<asp:BulletedList
    AccessKey="string"
    AppendDataBoundItems="True|False"
    AutoPostBack="True|False"
    BackColor="color name|#dddddd"
    BorderColor="color name|#dddddd"
    BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge|
        Inset|Outset"
    BorderWidth="size"
    BulletImageUrl="uri"
    BulletStyle="NotSet|Numbered|LowerAlpha|UpperAlpha|LowerRoman|
        UpperRoman|Disc|Circle|Square|CustomImage"
    CausesValidation="True|False"
    CssClass="string"
    DataMember="string"
    DataSource="string"
    DataSourceID="string"
    DataTextField="string"
    DataTextFormatString="string"
    DataValueField="string"
    DisplayMode="Text|HyperLink|LinkButton"
    Enabled="True|False"
    EnableTheming="True|False"
    EnableViewState="True|False"
    FirstBulletNumber="integer"
    Font-Bold="True|False"
    Font-Italic="True|False"
    Font-Names="string"
    Font-Overline="True|False"
    Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|
        Medium|Large|X-Large|XX-Large"
    Font-Strikeout="True|False"
    Font-Underline="True|False"
    ForeColor="color name|#dddddd"
    Height="size"
    ID="string"
    OnClick="Click event handler"
    OnDataBinding="DataBinding event handler"
    OnDataBound="DataBound event handler"
    OnDisposed="Disposed event handler"
    OnInit="Init event handler"
    OnLoad="Load event handler"
    OnPreRender="PreRender event handler"
    OnSelectedIndexChanged="SelectedIndexChanged event handler"
    OnTextChanged="TextChanged event handler"
    OnUnload="Unload event handler"
    runat="server"
    SkinID="string"
    Style="string"
    TabIndex="integer"
    Target="string|_blank|_parent|_search|_self|_top"
    ToolTip="string"
    ValidationGroup="string"
    Visible="True|False"
    Width="size"
>
            <asp:ListItem
                Enabled="True|False"
                Selected="True|False"
                Text="string"
                Value="string"
            />
</asp:BulletedList>

备注:使用 BulletedList 控件创建设置为项目符号格式的项列表。若要指定要在 BulletedList 控件中显示的各列表项,请针对每项在 BulletedList 控件的开始标记和结束标记之间放置一个 ListItem 对象。

示例

下面的代码示例演示如何创建一个 BulletedList 控件,该控件具有设置为链接按钮格式的列表项。

Visual Basic

<asp:BulletedList id="ItemsBulletedList" BulletStyle="Disc"
                  DisplayMode="LinkButton" runat="server">
  <asp:ListItem Value="http://www.ruanchen.com">RuanChen Com</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>

C#

<asp:BulletedList id="ItemsBulletedList" BulletStyle="Disc"
                  DisplayMode="LinkButton" runat="server">
  <asp:ListItem Value="http://www.ruanchen.com">RuanChen Com</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>