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

Simple RADMenu Example

2 Answers 273 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Graham
Top achievements
Rank 1
Graham asked on 20 Mar 2014, 01:22 PM
Hello

I would be grateful if you someone could provide a simple menu example, could be this example: http://demos.telerik.com/aspnet-ajax/menu/examples/overview/defaultcs.aspx. Cannot seem to extract just the menu pages from the Live Demos example

do I have to use user controls for each tab? I want a web site with a home, product, about sections

thanks

graham 

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 25 Mar 2014, 05:19 AM
Hi Graham,

Please try the following sample code snippet to achieve your scenario. Let me know if you have any concern.

ASPX:
<telerik:RadMenu ID="RadMenu1" runat="server" Skin="Silk">
    <Items>
        <telerik:RadMenuItem Text="Home" NavigateUrl="DefaultCS.aspx" />
        <telerik:RadMenuItem Text="Products">
            <GroupSettings Width="200px" />
            <Items>
              <telerik:RadMenuItem Text="Chairs" NavigateUrl="DefaultCS.aspx?page=chairs">
              </telerik:RadMenuItem>
            </Items>
        </telerik:RadMenuItem>
        <telerik:RadMenuItem Text="Sections" NavigateUrl="DefaultCS.aspx?page=strores" />
    </Items>
</telerik:RadMenu>

C#:
protected override void OnInit(EventArgs e)
{
    RadMenuItem currentItem = RadMenu1.FindItemByUrl(Request.Url.PathAndQuery);
    if (currentItem != null)
    {
        currentItem.HighlightPath();
        switch (currentItem.Text)
        {
            //load the user control pages based on the menu item clicked
            //all user control pages in one folder called UserControls
            case "Home":
                Control userControlHome = Page.LoadControl("UserControls/Home.ascx");
                Content.Controls.Add(userControlHome);
                break;
            case "Chairs":
                Control userControlChairs = Page.LoadControl("UserControls/Chairs.ascx");
                Content.Controls.Add(userControlChairs);
                break;
            case "Sections":
                Control userControl = Page.LoadControl("UserControls/Sections.ascx");
                Content.Controls.Add(userControl);
                break;
        }
    }
    base.OnInit(e);
}

Thanks,
Princy.
0
Graham
Top achievements
Rank 1
answered on 08 Apr 2014, 07:10 AM
thanks Princy, I will give this a try
Tags
Menu
Asked by
Graham
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Graham
Top achievements
Rank 1
Share this question
or