This example demonstrates how to manipulate a navbar control programmatically on the client using our extended client-side functionality. The client-side programmatic interface is available if the EnableClientSideAPI property is set to true or if there is a handler assigned to any client-side event.
In this demo, each group or item of the navbar control is identified using its Name property. In order to obtain a specific navbar group or item by its name on the client, the GetGroupByName or GetItemByName method is used respectively. In this demo, the navbar's AutoCollapse mode is enabled which specifies that only one group can be expanded within the navbar at any point in time. In this mode, the SetActiveGroup method can be used to expand the desired group. (See JS code, the ChangeActiveGroup function)
A specific navbar item can be selected within each group via the SetSelectedItem method by passing it the required item. (See JS code, the ChangeSelectedItem function)
The GroupExpandedChanged function that is a handler of the navbar's ExpandedChanged event (see ASPX and JS code) demonstrates how to synchronize values of the dropdown editors with the expanded group and the group's selected item, if any.
In the ShowProperties function (see JS code), the active group and the item selected within the group are obtained with the help of the GetActiveGroup and GetSelectedItem methods; and information on the index and name properties of these groups and items is displayed.
The code of the ShowActiveItems function (see JS code) demonstrates the way in which you can traverse through all the items of a specified group.
Note that an individual client object can be referenced either directly by its ID (for instance, by using the following code: ASPxNavBar1.ExpandAll()) or by using the Get method of a common collection for our ASPx web controls (this can be useful when our web control is contained within a UserControl or MasterPage: that is when the resulting client ID is generated by a specific NamingContainer). The GetNavBar function (see JS code) demonstrates how to access a client navbar object by means of our control collection.