Menu / Mega Drop-Down created dynamically from SQL

3 posts, 1 answers
  1. Robert
    Robert avatar
    4 posts
    Member since:
    Sep 2012

    Posted 05 Oct 2012 Link to this post

    I am having issues trying to figure out how to create a mega menu dynamically from SQL server.
    I have a normal telerik menu working fine from SQL.  My SQL server is setup using a Parent Child to create the sub menus.

    Existing

    <telerik:RadMenu id="globalNavigation" runat="server"

     

    EnableRoundedCorners="true"

     

    EnableAjaxSkinRendering="true"

     

    Skin="Telerik"

     

    ExpandDelay="200"

     

    ClosingDelay="50"

     

    OnClientItemOpened="itemOpened"

     

    CausesValidation="false"

     

    EnableEmbeddedSkins="false"

     

    EnableShadows="true"

     

    ClickToOpen="true">

    </telerik:RadMenu>

    SQL Table is setup (as an example)
    idMenuID  vcName     inParentID     URL 
    1         Home         NULL         ~/default.aspx
    2         Country      NULL         ~/Country/default.aspx 
    3         Training     NULL         ~/Training/default.aspx
    4         Student      NULL         ~/Student/default.aspx
    11        Option A     2           ~/Country/defaultA.aspx
    12        Option B    2            ~/Country/defaultB.aspx

    Within the radmenu of a mega drop down it includes
    <telerik:RadMenuItem Text="Products" PostBack="false">

     <Items>

     <telerik:RadMenuItem CssClass="Products" Width="640px">

     <ItemTemplate>

     <div id="CatWrapper" class="Wrapper" style="width: 435px;">

     <h3>

     Categories
    <
    /h3>

     <telerik:RadSiteMap ID="RadSiteMap1" runat="server" Skin="Hay" EnableTextHTMLEncoding="true">

     <LevelSettings>

     <telerik:SiteMapLevelSetting Level="0">

     <ListLayout RepeatColumns="2" RepeatDirection="Vertical" />

     </telerik:SiteMapLevelSetting>

     </LevelSettings>

     <Nodes>

     <telerik:RadSiteMapNode NavigateUrl="#" Text="Student">

     <Nodes>

     <telerik:RadSiteMapNode NavigateUrl="#" Text="ITO Student PTO" />

     <telerik:RadSiteMapNode NavigateUrl="#" Text="Review of All ITO's" />

     </Nodes>

     </telerik:RadSiteMapNode>

     <telerik:RadSiteMapNode NavigateUrl="#" Text="Decor">

     <Nodes>

     <telerik:RadSiteMapNode NavigateUrl="#" Text="Bed Linen" />

     <telerik:RadSiteMapNode NavigateUrl="#" Text="Throws" />

     <telerik:RadSiteMapNode NavigateUrl="#" Text="Curtains & Blinds" />

     <telerik:RadSiteMapNode NavigateUrl="#" Text="Rugs" />

     <telerik:RadSiteMapNode NavigateUrl="#" Text="Carpets" />

     </Nodes>

     </telerik:RadSiteMapNode>

    </telerik:RadSiteMap>

     </div>

     </ItemTemplate>

     </telerik:RadMenuItem>

     </Items>

     </telerik:RadMenuItem>


    This is within the Mega Drop Menu.   How would I create these item dynamically.  Would someone have an example of how to write this within the code behind or created dyanmically.

  2. Robert
    Robert avatar
    4 posts
    Member since:
    Sep 2012

    Posted 07 Oct 2012 Link to this post

    I was hoping for a reply from a Telerik developer.  Basically how to create a mega drop down list server side using a SQL server.   
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 09 Oct 2012 Link to this post

    Hello Robert,

    I prepared a sample project based on the provided markup code. RadSiteMap control is bound to SQL data source and loads dynamically. It uses table named Links that has additional column URL, so I believe it fits your requirements. Please find the attached project.

    I hope that you will find it helpful.

    Kind regards,
    Boyan Dimitrov
    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.
Back to Top