Prasad,
Try the following, might not be most efficient but works.
Here is the ASPX
<dx:ASPxRoundPanel ID="ASPxRoundPanel2" HeaderText="Some Menu" runat="server" Width="205px"
Theme="Office2010Blue">
<PanelCollection>
<dx:PanelContent>
<dx:ASPxNavBar ID="ASPxNavBar1" runat="server" Theme="Office2010Blue" Width="100%">
</dx:ASPxNavBar>
</dx:PanelContent>
</PanelCollection>
</dx:ASPxRoundPanel>
Here is the c# Code...
public partial class uc_menu : System.Web.UI.UserControl
{
List<MenuInfo> menuItems = new List<MenuInfo>();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
int i = 1;
menuItems.Add(new MenuInfo() { MenuId = i++, MenuName = "ItemName1", MenuText = "itemText1", MenuUrl = @"http://Somesite/Page1.aspx", MenuGroup = "Group1" });
menuItems.Add(new MenuInfo() { MenuId = i++, MenuName = "ItemName2", MenuText = "itemText2", MenuUrl = @"http://Somesite/Page2.aspx", MenuGroup = "Group1" });
menuItems.Add(new MenuInfo() { MenuId = i++, MenuName = "ItemName3", MenuText = "itemText3", MenuUrl = @"http://Somesite/Page3.aspx", MenuGroup = "Group3" });
menuItems.Add(new MenuInfo() { MenuId = i++, MenuName = "ItemName4", MenuText = "itemText4", MenuUrl = @"http://Somesite/Page4.aspx", MenuGroup = "Group1" });
menuItems.Add(new MenuInfo() { MenuId = i++, MenuName = "ItemName5", MenuText = "itemText5", MenuUrl = @"http://Somesite/Page5.aspx", MenuGroup = "Group2" });
}
BuildNavBarItems(this.ASPxNavBar1, menuItems, "Main Menu Title");
}
private void BuildNavBarItems(ASPxNavBar navbar, List<MenuInfo> menuitems, string menutitle)
{
this.ASPxRoundPanel2.HeaderText = menutitle;
string navUrl = string.Empty;
Dictionary<string, NavBarGroup> navGroups =
new Dictionary<string, NavBarGroup>();
navbar.Groups.Clear();
foreach (MenuInfo m in menuitems)
{
navUrl = m.MenuUrl;
if (navGroups.ContainsKey(m.MenuGroup))
navGroups[m.MenuGroup].Items.Add(new NavBarItem(m.MenuText, "", "", navUrl));
else
{
NavBarGroup navgroup = navbar.Groups.Add(m.MenuGroup, m.MenuGroup);
navgroup.Items.Add(new NavBarItem(m.MenuText, "", "", navUrl));
navGroups.Add(m.MenuGroup, navgroup);
}
}
}
private class MenuInfo
{
public int MenuId { get; set; }
public string MenuName { get; set; }
public string MenuText { get; set; }
public string MenuUrl { get; set; }
public string MenuGroup { get; set; }
}
}
I hope this helps.