473,480 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how can i create hierarcihal menu from database?

17 New Member
Expand|Select|Wrap|Line Numbers
  1.         SqlDataAdapter dadSubCat = new SqlDataAdapter();
  2.         dadSubCat.SelectCommand = new SqlCommand("SELECT ID,PID,Title FROM Page where userid='user1'", con);
  3.         DataSet dsCat = new DataSet();
  4.         dadSubCat.Fill(dsCat, "Page");
  5.         dsCat.Relations.Add("ParentChild", dsCat.Tables["Page"].Columns["ID"], dsCat.Tables["Page"].Columns["PID"], true);
  6.         int count = 0;
  7.         foreach (DataRow categoryRow in dsCat.Tables["Page"].Rows)
  8.         {
  9.             DataRow[] subCatRows = categoryRow.GetChildRows("ParentChild");
  10.             if (categoryRow.GetParentRows("ParentChild").Length == 0)
  11.             {
  12.                 skmMenu.MenuItem mNode = new skmMenu.MenuItem("<img src=\"menublip.gif\" align=\"absmiddle\">" + categoryRow["Title"].ToString(), "");
  13.  
  14.                 foreach (DataRow row in subCatRows)
  15.                 {
  16.                     string Title = row["Title"].ToString();
  17.                     mNode.SubItems.Add(new skmMenu.MenuItem(Title, ""));
  18.  
  19.  
  20.                 }
  21.  
  22.                Menu1.Items.Add(mNode);
  23.             }
  24.  
  25.         }
  26.  
i can put for one sub menu but in case of multiple sub menu,is there a possible easy way for that one?
Apr 30 '09 #1
5 3176
wastman
17 New Member
can any moderator help me out of this problem, instead of locking me from this post?
May 1 '09 #2
wastman
17 New Member
please help me for the above post.
May 1 '09 #3
tlhintoq
3,525 Recognized Expert Specialist
I think I would store store a value of the Parent name... then at creation time search through all the existing menu items until I find the parent name, then make the new item a child of that. That should let you keep going several layers deep, so long as you don't have repeats of menu entries. You couldn't have a "Save" under "Images" and a "Save" under "Documents" for example. If the stored parent name is null, then it must be a root level menu. If the stored value is not null, but doesn't exist in a given menu, then the stored name is the root level to make first.
May 1 '09 #4
tlhintoq
3,525 Recognized Expert Specialist
Yesterday, 01:02 AM - Original post
Today, 12:41 AM - bump (to be polite about it)
Today, 06:08 AM - bump

Dude... Relax and have some patience with the volunteers here. This isn't a site where you are paying people for tech support. Anyone with the background to give you help probably has a job and is not just sitting around the computer waiting for questions. Some experts check the site once a day, others throughout the day while at the office, but not from home, others only from home but can't during the work day. etc. At the moment I am doing an installation in a foreign country and am limited to when this 3rd world internet is working, and I'm not installing computers down in one of the caves (really, in caves.)

Instead of just waiting for someone to reply to your question... Maybe there are other areas of your program you could work on and come back to the menus later... or you could experiment with several different ways of doing the menus. Finding alternative perspectives and alternative approaches is vital do this line of work.
May 1 '09 #5
Hamayun Khan
106 New Member
@wastman


look into the Display Hierarchical Data with TreeView in ASP.NET 2.0
http://aspalliance.com/732
May 4 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

8
3879
by: Raymond H. | last post by:
Hello, 1- How to see, in a Label, the URL of a link that the mouse pass over? (in the WebBrower control in a vb projet). 2- How to create a menu and a submenu via a button Command1? and...
9
2428
by: badboybrown | last post by:
Hello, Is it possible to step through the "Create MDE" process and see what is causing Access to crash? I tried, unsuccessfully, many times to create an MDE from my database. But, randomly, I...
0
1464
by: tommie.nygren | last post by:
I am using Visual Studio.NET 2003 Enterprise Architect Edition (according to my IT guy... how do I actually check what version of it I am using?) and SQL Server Developer Edition (8.00.194 for you...
8
5053
by: Peter | last post by:
Would someone provide a gentle explanation of how programs such as Adobe Acrobat and Crystal Reports are able to add toolbars to the Access UI. (So that when you start msaccess.exe these toolbars...
27
3739
by: max | last post by:
Hello, I am a newbye, and I'm trying to write a simple application. I have five tables with three columns; all tables are identical; I need to change some data in the first table and let VB...
0
16989
MMcCarthy
by: MMcCarthy | last post by:
These are the basic instructions on how to create an mde file. Create a backup copy of your "filename.mdb" frontend Go to Tools - Startup and set the startup form to the switchboard/menu form...
17
7793
by: DeZZar | last post by:
Hi all, I need to regularly backup my database as an Excel file and have been using the File Export option. Problem is I need anyone using the database to be able to do this easily - nopt...
2
2327
by: Jay Douglas | last post by:
Hi community, I would like to add a new custom menu item to the right click context menu's in notepad and the cmd shell. The same context menu that displays edit, paste, etc. Example, someone...
3
1821
by: raaja | last post by:
How to create Horizontal dropdown menu, tat menu items coming from database.
0
6908
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7048
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6741
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6956
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5342
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4783
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4485
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2986
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.