Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

BulletedList.AutoPostBack Property

Gets or sets the value of the AutoPostBack property for the base class.

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

[BrowsableAttribute(false)]
public override bool AutoPostBack { get; set; }

Property Value

Type: System.Boolean
false.

ExceptionCondition
NotSupportedException

An attempt was made to assign a value to the AutoPostBack.

The AutoPostBack property is inherited from the ListControl class and is not applicable to the BulletedList control. Do not assign a value to the AutoPostBack property. If you do assign a value to the AutoPostBack, a NotSupportedException exception is thrown.

The following code example demonstrates that the value of the AutoPostBack property is always false for the BulletedList control and therefore is not applicable to this class.

<%@ Page Language="C#" %>

<!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>AutoPostBack Property Example</title>
<script language="c#" runat="server">

        void Page_Load(Object sender, EventArgs e)
        {
            // Get the value of AutoPostBack for this bulleted list.
            bool value;
            value = ItemsBulletedList.AutoPostBack;

            // This property is not applicable to the BulletedList class.
            // This message will never be displayed.
            if(value)
            {
                Message.Text = "The value of the AutoPostBack property is True.";
            }

            // The default AutoPostBack value inherited from ListControl is False.
            // This message will always be displayed.
            if(!value)
            {
                Message.Text = "The value of the AutoPostBack property is " + value.ToString() + "."
                    + "This property is inherited by the ListControl class."
                    + "It is not applicable to the BulletedList class.";
            }
        }       


    </script>

</head>
<body>

    <h3>AutoPostBack Property Example</h3>

    <form id="form1" runat="server">

        <asp:BulletedList id="ItemsBulletedList" 
            BulletStyle="Disc"
            DisplayMode="Text" 
            runat="server">    
                <asp:ListItem Value="0">The first list item.</asp:ListItem>
            <asp:ListItem Value="1">The second list item.</asp:ListItem>
            <asp:ListItem Value="2">The third list item.</asp:ListItem>
            <asp:ListItem Value="3">The fourth list item.</asp:ListItem>
        </asp:BulletedList>        

    <p>        
    <asp:Label id="Message" 
        Font-Size="12"
        Width="368px" 
        runat="server"/></p>

    </form>

</body>
</html>

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0
Show:
© 2015 Microsoft