Export (0) Print
Expand All

BulletedListEventArgs Class

Provides data for the Click event of a BulletedList control.

System.Object
  System.EventArgs
    System.Web.UI.WebControls.BulletedListEventArgs

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

public class BulletedListEventArgs : EventArgs

The BulletedListEventArgs type exposes the following members.

  NameDescription
Public methodBulletedListEventArgsInitializes a new instance of the BulletedListEventArgs class.
Top

  NameDescription
Public propertyIndexGets the index of the list item in a BulletedList control that raised the event.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The Click event is raised when a link button in a BulletedList control is clicked.

For a list of initial property values for an instance of the BulletedListEventArgs class, see the BulletedListEventArgs constructor.

The following example demonstrates how to specify and code an event handler for the Click event of a BulletedList control. When a list item is clicked, a message is displayed in a Label on the page.

<%@ 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>BulletedList Click Example</title>
  <script runat="server">

    void ItemsBulletedList_Click(object sender, System.Web.UI.WebControls.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.");
			    break;
	    }

    }

  </script>

</head>
<body>

  <h3>BulletedList Click Example</h3>

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

    <p>Click on an item in the list to raise the Click event.</p> 

    <asp:BulletedList id="ItemsBulletedList" 
      BulletStyle="Disc"
      DisplayMode="LinkButton" 
      OnClick="ItemsBulletedList_Click"
      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>

    <asp:Label id="Message" 
      Font-Size="12"
      Width="168px" 
      Font-Bold="True" 
      runat="server"
      AssociatedControlID="ItemsBulletedList"/>

   </form>

</body>
</html>

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft