<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Menu.aspx.cs" Inherits="MyTelerikSamples.Menu" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
</
telerik:RadScriptManager
>
<
telerik:RadPanelBar
ID
=
"RadPanelBar1"
runat
=
"server"
Skin
=
"Outlook"
Width
=
"190px"
>
<
Items
>
<
telerik:RadPanelItem
runat
=
"server"
Text
=
"Root Panel Item"
Expanded
=
"true"
Selected
=
"true"
>
<
Items
>
<
telerik:RadPanelItem
runat
=
"server"
Value
=
"templateHolder"
>
</
telerik:RadPanelItem
>
</
Items
>
</
telerik:RadPanelItem
>
</
Items
>
<
CollapseAnimation
Duration
=
"100"
Type
=
"None"
/>
<
ExpandAnimation
Duration
=
"100"
Type
=
"None"
/>
</
telerik:RadPanelBar
>
</
div
>
</
form
>
</
body
>
</
html
>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
namespace MyTelerikSamples
{
public partial class Menu : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
RadPanelItem panelItem = (RadPanelItem)RadPanelBar1.FindItemByValue("templateHolder");
RadMenu myMenu = new RadMenu();
myMenu.Width = Unit.Percentage(100);
myMenu.Skin = "Outlook";
myMenu.Flow = ItemFlow.Vertical;
RadMenuItem MainItem = new RadMenuItem("Main Item");
RadMenuItem Child1 = new RadMenuItem("Child 1");
Child1.Width = Unit.Percentage(100);
RadMenuItem Child2 = new RadMenuItem("Child 2");
Child2.Width = Unit.Percentage(100);
MainItem.Items.Add(Child1);
MainItem.Items.Add(Child2);
myMenu.Items.Add(MainItem);
panelItem.Controls.Add(myMenu);
}
}
}
}
http://www.telerik.com/help/aspnet-ajax/radpanelbar-dynamically-created-radmenu.html
Unable to see the menu on top of RadPanelBar1 and only able to see only 1 submenu item "Child 1" if i donot set myMenu.Width to 100%.
I donot want to increase the height of the panel as I have some other items to be shown below myMenu.
Please help me.