This is a migrated thread and some comments may be shown as answers.

RadPanelBar with dynamically created RadMenu

3 Answers 140 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Subramanyam
Top achievements
Rank 1
Subramanyam asked on 25 Oct 2010, 02:45 PM
<%@ 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">
 
<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);
            }
        }
    }
}
I tried this solution given in the below link. Which did not work.
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.

3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 28 Oct 2010, 07:29 PM
Hi Subramanyam,

I tried to reproduce this issue at our side but to no avail. I've attached a screenshot to show you the result. What is different in your case?

Sincerely yours,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Rachana
Top achievements
Rank 1
answered on 04 Sep 2012, 07:20 AM
HI,

actually i need to create Rad Panel bar's Dynamically....based on input provided ....if provided input is 6..then it should create 6 panel bars dynamically...For more information please find the attached image....Is it correct choice for these requirement using panel bar or any  other control i should use..please suggest me..if its rad panel bar..how to create from code behind panel bars
0
Helen
Telerik team
answered on 04 Sep 2012, 10:54 AM
Hello Rachana,

If you just need a list of items without expand/collapse functionality I may suggest you to try our RadListBox control:
http://demos.telerik.com/aspnet-ajax/listbox/examples/default/defaultcs.aspx


Greetings,
Helen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
PanelBar
Asked by
Subramanyam
Top achievements
Rank 1
Answers by
Yana
Telerik team
Rachana
Top achievements
Rank 1
Helen
Telerik team
Share this question
or