Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to use recursion to build dynamic menu from database in c#

How to use recursion to build dynamic menu from database in c#

Scheduled Pinned Locked Moved C#
csharpasp-netdatabasedotnetcom
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mahmoud EL Shazly
    wrote on last edited by
    #1

    I'm trying to build a dynamic menu from database and pass it to DevExpress Menu control my table looks like: (Primary) (int) - nvarchar(50) - (int) Iserial - Department - ParentIserial if the department has no parent then ParentIserial = 0 otherwise it will = the parent's Iserial Ibuilt the model like this

    public class TblDepartments {

    \[Key\]
    \[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)\]
    public int Iserial { get; set; }
    public nvarchar(50) Department { get; set; }
    public int ParentIserial{ get; set; }
    public IEnumerable items { get; set; }
    

    }

    and I was following this link Overview - ASP.NET Core Menu Demo | DevExpress[^] so please tell me how to build the structure same as the have done it on their demo to pass it to the control Thanks in advance

    JusT LeT YouR MinD WorK

    OriginalGriffO M 2 Replies Last reply
    0
    • M Mahmoud EL Shazly

      I'm trying to build a dynamic menu from database and pass it to DevExpress Menu control my table looks like: (Primary) (int) - nvarchar(50) - (int) Iserial - Department - ParentIserial if the department has no parent then ParentIserial = 0 otherwise it will = the parent's Iserial Ibuilt the model like this

      public class TblDepartments {

      \[Key\]
      \[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)\]
      public int Iserial { get; set; }
      public nvarchar(50) Department { get; set; }
      public int ParentIserial{ get; set; }
      public IEnumerable items { get; set; }
      

      }

      and I was following this link Overview - ASP.NET Core Menu Demo | DevExpress[^] so please tell me how to build the structure same as the have done it on their demo to pass it to the control Thanks in advance

      JusT LeT YouR MinD WorK

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      Why not ask the people who wrote the demo? You have a licence to use the controls, which gives you access to tech support from them - so use it!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      M 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        Why not ask the people who wrote the demo? You have a licence to use the controls, which gives you access to tech support from them - so use it!

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

        M Offline
        M Offline
        Mahmoud EL Shazly
        wrote on last edited by
        #3

        I don't only need the code I need to understand it

        OriginalGriffO 1 Reply Last reply
        0
        • M Mahmoud EL Shazly

          I don't only need the code I need to understand it

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          Again, why not ask them? They know their demo better than we will ...

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          M 1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            Again, why not ask them? They know their demo better than we will ...

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

            M Offline
            M Offline
            Mahmoud EL Shazly
            wrote on last edited by
            #5

            I already asked them but still no reply, However what I need is to understand how to populate sql server table to build the dynamic menu no matter to devexpress or even writing the html manually I hope you got my point

            1 Reply Last reply
            0
            • M Mahmoud EL Shazly

              I'm trying to build a dynamic menu from database and pass it to DevExpress Menu control my table looks like: (Primary) (int) - nvarchar(50) - (int) Iserial - Department - ParentIserial if the department has no parent then ParentIserial = 0 otherwise it will = the parent's Iserial Ibuilt the model like this

              public class TblDepartments {

              \[Key\]
              \[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)\]
              public int Iserial { get; set; }
              public nvarchar(50) Department { get; set; }
              public int ParentIserial{ get; set; }
              public IEnumerable items { get; set; }
              

              }

              and I was following this link Overview - ASP.NET Core Menu Demo | DevExpress[^] so please tell me how to build the structure same as the have done it on their demo to pass it to the control Thanks in advance

              JusT LeT YouR MinD WorK

              M Offline
              M Offline
              Mycroft Holmes
              wrote on last edited by
              #6

              Your class defines the table structure required (and vice versa) so ID - IdentityField ISerial - int - probably defines the sort order within the parents collection Department - self evident ParentISerial - I think thes is wrong as it should be the ParentID field Add the collection of children in the client.

              Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

              M 1 Reply Last reply
              0
              • M Mycroft Holmes

                Your class defines the table structure required (and vice versa) so ID - IdentityField ISerial - int - probably defines the sort order within the parents collection Department - self evident ParentISerial - I think thes is wrong as it should be the ParentID field Add the collection of children in the client.

                Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

                M Offline
                M Offline
                Mahmoud EL Shazly
                wrote on last edited by
                #7

                Thanks for your reply can you please give more clarifications ?

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups