$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
How to Put up Item Basic of Navigationbar Using C#
Home > How to > NavigationBar Basic Items

This page is arranged to guide users to add root items and child items by using KT.UI Navigationbar controls. In addition to this, comprehensive C# demo codes are offered for setting Navigationbar properties.

How to Use Demo C# Code to Add Root Item

Root Items mean the items at the top level, and these items are always visible on web page. We can set root items by using Items property of the navigation bar. And each root items can contain single or multiple level items or child items.

PerNavigationItem rootItem1 = new PerNavigationItem();
rootItem1.Text = "Spring";
rootItem1.ImageUrl = "../../../../Images/NavigationBar/Spring.jpg";
rootItem1.ImagePosition = PerNavigationItemImagePosition.Left;
PerNavigationBar1.Items.Add(rootItem1);

PerNavigationItem rootItem2 = new PerNavigationItem();
rootItem2.Text = "Summer";
rootItem2.ImageUrl = "../../../../Images/NavigationBar/Summer.jpg";
rootItem2.ImagePosition = PerNavigationItemImagePosition.Left;
PerNavigationBar1.Items.Add(rootItem2);

How to Use C# Sample codes to Add Level Item

What is level item: each root item may have a set of child items, which can be called level items and child items. The children of the root items are always considered level 1 items. Children items can be set and added by using the Items property of the root item (PerNavigationBar.Items). Child items may have their own sets of child items. And children of level 1 items are considered level 2 items; thus, logically speaking, children of level 2 items are considered level 3 items; and so on.

PerNavigationItem levelItem = new PerNavigationItem();
levelItem.Text = "Cantaloupe";
levelItem.ImageUrl = "../../../../Images/NavigationBar/Cantaloupe.jpg";
levelItem.ImagePosition = PerNavigationItemImagePosition.Left;
rootItem1.Items.Add(levelItem);

How to Use C# Example Codes to Set Item Properties


PerNavigationBar1.Items[0].Enabled = true;
PerNavigationBar1.Items[0].Expanded = true;
PerNavigationBar1.Items[0].Items[0].Selected = true;
PerNavigationBar1.Items[0].ImageUrl = "../../../../Images/NavigationBar/Spring.jpg";
PerNavigationBar1.Items[0].ImagePosition = PerNavigationItemImagePosition.Left;
PerNavigationBar1.Items[0].Text = "Spring";
In this part, we also give a table list below that contains the items and properties of NavigationBar control of KT.UI for ASP.NET AJAX. If users read carefully, you can be well informed of all of these important properties within web ASP.NET application, thus, you can easily set and program your own defined navigation bar.
  • Enabled: this item offer the choices for enabling item or disabling item.
  • Expanded: users can use this property to specify whether the item is expanded.
  • PreventCollapse: users can use this item to define whether collapse the item once it is expanded.
  • Selected: this can be used to customize whether the item is selected.
  • IsSeparator: when set this property as true, users can add a line below the Item.
  • ImageUrl: use this property to specify the image on the Item, when click by using mouse or when the item is collapsed or expanded, users can set different image.
  • ImagePosition: use this attribute to set and change the position of the image in the navigation bar.
  • Text: use this property to set and defined the text displaying on Item.
ASP.NET AJAX UI Controls