dynamic main menu

V

varun kanwar

ok i tell u in detail.

database is:

menu_bar option_no menu_option
1 0 a
2 1 b
3 2 c
4 2 d
5 1 e
6 1 f
7 0 g
8 7 h
9 7 i
10 9 j
11 9 k
12 7 l


my coding is:

Dim mainMenu1 As New MainMenu
Dim menuItem As New MenuItem

conn.Open()
cmd.CommandText = "select * from user_profile where
option_no=0"
cmd.Connection = conn
dr = cmd.ExecuteReader
While dr.Read
menuItem.Text = Convert.ToString(dr(1))
mainMenu1.MenuItems.Add(menuItem.Text)
End While

dr.Close()
conn.Close()
Menu = mainMenu1


and output should be:

a g
|->b |->h
. |->c |->i
. |->d . |->j
|->e . |->k
|->f |->l


this code adds "a" and "g" but i m unable to add rest of child and sub
child items.
i have shown u the database hope u can generate dynamic main menu from
there as output is required.
 
T

tomb

You are only selecting 'a' and 'g' when you restrict your record
selection with "where option_no = 0".
Where are the sub-menus for 'a' and 'g' supposed to come from?

T
 
V

varun kanwar

cmd.CommandText = "select * from user_profile"

ok llets change the command to this but even then how will i
distinguish between parent menu and child menu.

and big problem is where to right code to add child menu to parent menu.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top