This documentation is archived and is not being maintained.

BulletedList.FirstBulletNumber Property

Gets or sets the value that starts the numbering of list items in an ordered BulletedList control.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public virtual int FirstBulletNumber { get; set; }
/** @property */
public int get_FirstBulletNumber ()

/** @property */
public void set_FirstBulletNumber (int value)

public function get FirstBulletNumber () : int

public function set FirstBulletNumber (value : int)

Not applicable.

Property Value

The value that starts the numbering of list items in an ordered BulletedList control. The default is 1.

Use the FirstBulletNumber property to specify the value that starts the numbering of list items in an ordered BulletedList control. The value that is assigned to the FirstBulletNumber property is ignored, if the BulletStyle property is set to the Disc, Square, Circle, or CustomImage values. Although the value of the FirstBulletNumber property is an integer, it does not always cause a bullet to render as a number. For example, if you set the FirstBulletNumber property to 4 and set the BulletStyle property to the value LowerAlpha, the first bullet number will render as a lowercase d.

The value of this property is stored in view state.

The following code example demonstrates how to create a BulletedList control and set the FirstBulletNumber property to specify the value that starts the numbering of list items in the BulletedList control. The value that starts the numbering of the list items changes based on the value that the user enters in the text box.

Security noteSecurity Note:

This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview (Visual Studio).

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>First Bullet Number Example</title>
<script runat="server">

        Sub Index_Changed(ByVal sender As Object, ByVal e As System.EventArgs)
            ' Set the starting number for the bulleted list.
            ItemsBulletedList.FirstBulletNumber = StartValue.Text
            Select Case (BulletStylesListBox.SelectedIndex)
                Case 0
                    ItemsBulletedList.BulletStyle = BulletStyle.Numbered
                Case 1
                    ItemsBulletedList.BulletStyle = BulletStyle.LowerAlpha
                Case 2
                    ItemsBulletedList.BulletStyle = BulletStyle.UpperAlpha
                Case 3
                    ItemsBulletedList.BulletStyle = BulletStyle.LowerRoman
                Case 4
                    ItemsBulletedList.BulletStyle = BulletStyle.UpperRoman
                Case 5
                    MsgBox("You selected NotSet. The bullet type will be determined by the browser.", _
                    MsgBoxStyle.Information, "BulletedList.BulletStyle")
                Case Else
                    Throw New Exception("You did not select a valid bullet style")
            End Select
        End Sub

    </script>

</head>
<body>

    <h3>First Bullet Number Example</h3>

    <form id="form1" runat="server">
                    
        <asp:BulletedList id="ItemsBulletedList"             
        BulletStyle="Disc" 
        DisplayMode="Text"
        runat="server">    
        <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>    
              
        <hr />
        
        <h4>Enter the first number to start the list</h4>        
        
    <asp:TextBox id="StartValue" 
        Text="1"
        runat="server">
    </asp:TextBox><br />    
            
    <asp:RangeValidator id="Range1" 
        ControlToValidate="StartValue"
        MinimumValue="1"
        MaximumValue="32000"
        Type="Integer"
        ErrorMessage="Please enter a number greater than zero and less than 32,000."
        runat="server" >
    </asp:RangeValidator><br />            
        
        <h4>Select a bullet type:</h4>
        <asp:ListBox id="BulletStylesListBox" 
        SelectionMode="Single"
            Rows="1"
            AutoPostBack="True"
            Onselectedindexchanged="Index_Changed"
        runat="server" >        
                <asp:ListItem Value="Numbered">Numbered</asp:ListItem>
                <asp:ListItem Value="LowerAlpha">LowerAlpha</asp:ListItem>
                <asp:ListItem Value="UpperAlpha">UpperAlpha</asp:ListItem>
                <asp:ListItem Value="LowerRoman">LowerRoman</asp:ListItem>
                <asp:ListItem Value="UpperRoman">UpperRoman</asp:ListItem>       
                <asp:ListItem Value="NotSet">NotSet</asp:ListItem>
        </asp:ListBox><br />
        
        <hr />
    </form>

</body>
</html>

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Show: