Tab

ASPxMenuBase.ItemDataBound Event

Occurs after a menu item has been bound to a data source.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v21.1.dll

Declaration

public event MenuItemEventHandler ItemDataBound

Event Data

The ItemDataBound event's data class is MenuItemEventArgs. The following properties provide information specific to this event:

Property Description
Item Gets an item object related to the event.

Remarks

The ItemDataBound event is raised for each menu item after it’s data bound to the corresponding data from the specified data source. This event enables you to customize settings of the related menu item before it is finally rendered. Handling the ItemDataBound event correctly you can, for example, implement a custom logic to dynamically map properties of a menu control’s items to the required data fields.

The processed menu item can be accessed by using the MenuItemEventArgs.Item property of the event’s argument.

If the control functions in unbound mode, the ItemDataBound event isn’t raised.

Example

This example illustrates how to customize MenuItem in the ItemDataBound event handler. To add Html tags to MenuItems, set the ASPxMenu.EncodeHtml property to false.

View Example

<dx:ASPxMenu ID="ASPxMenu2" runat="server" EncodeHtml="false" DataSourceID="ASPxSiteMapDataSource1"
    OnItemDataBound="ASPxMenu2_ItemDataBound">
</dx:ASPxMenu>
<dx:ASPxSiteMapDataSource ID="ASPxSiteMapDataSource1" runat="server" SiteMapFileName="~/App_Data/Web.sitemap">
</dx:ASPxSiteMapDataSource>
See Also