Tab
A newer version of this page is available. Switch to the current version.

NavBarItem.Selected Property

Gets or sets a value that specifies whether the item is selected.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

[DefaultValue(false)]
public bool Selected { get; set; }

Property Value

Type Default Description
Boolean

false

true if the item is selected; otherwise, false.

Remarks

If the ASPxNavBar.AllowSelectItem property is set to true, end users are allowed to select items via mouse clicks. The navbar also provides the ability to select a particular item via code. You can use the Selected property of an item for this purpose.

Note that the item whose Selected property is set to true is displayed selected only if the item link mode in its group is set to the GroupItemLinkMode.ContentBounds value (which can be specified by either the navbar’s ASPxNavBar.ItemLinkMode or the group’s NavBarGroup.ItemLinkMode property).

In order to select a specific item from the level of a navbar control, use the navbar’s ASPxNavBar.SelectedItem property instead.

Examples

This example demonstrates how images for the selected, hot-tracked and disabled item states can be defined within a web control (the ASPxNavBar in this case).

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="DevExpress.Web.v8.3" Namespace="DevExpress.Web.ASPxNavBar" 
TagPrefix="dxnb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<script runat="server">
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
 <head id="Head1" runat="server">
     <title>Selected and Hottrack images</title>
 </head>
 <body>
     <form id="form1" runat="server">
     <div>
         <dxnb:ASPxNavBar ID="ASPxNavBar1" runat="server" AllowExpanding="False" 
              ShowExpandButtons="False" AllowSelectItem="True">
             <Paddings Padding="0px" />
             <Groups>
                 <dxnb:NavBarGroup Text="Hottracked item">
                     <Items>
                         <dxnb:NavBarItem Text="Selected" Selected="True" />
                         <dxnb:NavBarItem Text="User" />
                         <dxnb:NavBarItem Text="Disabled" Enabled="False" />
                     </Items>
                 </dxnb:NavBarGroup>
             </Groups>
             <ItemImage Height="15px" Url="~/ASPxperience/Common/Images/Images/User.gif" 
                UrlDisabled="~/ASPxperience/Common/Images/Images/UserDisabled.gif"
                 UrlHottracked="~/ASPxperience/Common/Images/Images/UserHottracked.gif" 
                UrlSelected="~/ASPxperience/Common/Images/Images/UserSelected.gif"
                 Width="12px" />
         </dxnb:ASPxNavBar>
     </div>
     </form>
 </body>
 </html>
See Also