Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

BulletedListEventHandler Delegate

Note: This delegate is new in the .NET Framework version 2.0.

Represents the method that will handle the Click event of a BulletedList control.

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

public delegate void BulletedListEventHandler (
	Object sender,
	BulletedListEventArgs e
)
/** @delegate */
public delegate void BulletedListEventHandler (
	Object sender, 
	BulletedListEventArgs e
)
JScript supports the use of delegates, but not the declaration of new ones.

Parameters

sender

The source of the event.

e

The argument of type BulletedListEventArgs that contains the event data.

When you create a BulletedListEventHandler delegate, you identify the method that will handle the Click event of a BulletedList control. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event-handler delegates, see Events and Delegates.

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 control on the page.

<%@ Page Language="VB" %>

<html>
<head>

    <script runat="server">

        Sub ItemsBulletedList_Click(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.BulletedListEventArgs)
            ' Change the message displayed in the label based on the index
            ' of the list item that was clicked.
            Select Case (e.Index)
                Case 0
                    Message.Text = "You clicked list item 1."
                Case 1
                    Message.Text = "You clicked list item 2."
                Case 2
                    Message.Text = "You clicked list item 3."
                Case Else
                    Throw New Exception("You did not click a valid list item.")
            End Select

        End Sub

    </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"/>
              
   </form>

</body>
</html>

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

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

.NET Framework

Supported in: 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.