Skip to main content
A newer version of this page is available. .
Tab

NavBarItemEventArgs.Item Property

Gets an item object related to the event.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v19.2.dll

Declaration

public NavBarItem Item { get; }

Property Value

Type Description
NavBarItem

A NavBarItem object, manipulations on which forced the event to be raised.

Remarks

The Item property represents a NavBarItem object concerned with raising the event.

Example

In the code sample below, the ASPxNavBar control is bound to an XML file using a standard XmlDataSource component. The item/group NavigateUrlField and TextField properties are used to specify the names of data item attributes from which the corresponding item/group settings should be obtained. The ItemDataBound and GroupDataBound events are handled to add corresponding images to items and groups respectively.

The image below shows the result.

ASPxNavBar_DataBoundEvents

protected void ASPxNavBar1_ItemDataBound(object source, DevExpress.Web.NavBarItemEventArgs e) {
     System.Xml.XmlNode dataItem = ((e.Item.DataItem as IHierarchyData).Item as System.Xml.XmlNode);
     switch (dataItem.Name) {
          case "ctor":
               e.Item.Image.Url = "Images/ctor.gif";
               break;
          case "property":
               e.Item.Image.Url = "Images/property.gif";
               break;
          case "method":
               e.Item.Image.Url = "Images/method.gif";
               break;
          case "event":
               e.Item.Image.Url = "Images/event.gif";
               break;
     }
}

protected void ASPxNavBar1_GroupDataBound(object source, DevExpress.Web.NavBarGroupEventArgs e) {
     e.Group.HeaderImage.Url = "Images/class.gif";
}
See Also