Simple RADMenu Example

3 posts, 0 answers
  1. Graham
    Graham avatar
    10 posts
    Member since:
    Mar 2014

    Posted 20 Mar 2014 Link to this post

    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. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 25 Mar 2014 in reply to Graham Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Graham
    Graham avatar
    10 posts
    Member since:
    Mar 2014

    Posted 08 Apr 2014 in reply to Princy Link to this post

    thanks Princy, I will give this a try
Back to Top