|
-
Sep 12th, 2012, 01:38 AM
#1
Thread Starter
Member
Problem main / submenu without menuControls
Hi Guys,
I have a problem with my ASP .net project. The problem that I have
is that i wanne build my main and submenu without the asp menu
controls.
This is my code that receive the data from my mysql database :
Code:
//VARS
private MySqlConnection DB_Connection;
protected void Page_Load(object sender, EventArgs e)
{
//DB Object
lib.libMySQL libMySQL = new lib.libMySQL();
//DB Open Connection
DB_Connection = libMySQL.open();
//DB Query
string DB_QUERY = "SELECT * " +
"FROM fe_mainmenu as fmm " +
"WHERE Visibility = 1 " +
"ORDER BY Priority DESC";
//DB Execute Query
MySqlCommand DB_CMD = new MySqlCommand(DB_QUERY, DB_Connection);
//DB get mainMenu
using (MySqlDataReader DB_RDR = DB_CMD.ExecuteReader())
{
if (DB_RDR.HasRows)
{
while (DB_RDR.Read())
{
}
DB_RDR.Close();
}
}
I have in my html code a var called : menuItems
So i wanne full this var with the menu items. Can you help me and put
me in the right direction?
-
Sep 12th, 2012, 05:27 AM
#2
Lively Member
Re: Problem main / submenu without menuControls
Don't use * as a starter name each column you want returned if only for clarity.
What do you mean by a HTML variable?
I imagine you mean a client side hidden field if so you will need to do it with some form of java script, can you clarify what you are expecting, perhaps post you "Html code" either way its going to have to be some kind of async java fun.
-
Sep 12th, 2012, 05:55 AM
#3
Re: Problem main / submenu without menuControls
 Originally Posted by domentarion
Hi Guys,
I have a problem with my ASP .net project. The problem that I have
is that i wanne build my main and submenu without the asp menu
controls.
This is my code that receive the data from my mysql database :
Code:
//VARS
private MySqlConnection DB_Connection;
protected void Page_Load(object sender, EventArgs e)
{
//DB Object
lib.libMySQL libMySQL = new lib.libMySQL();
//DB Open Connection
DB_Connection = libMySQL.open();
//DB Query
string DB_QUERY = "SELECT * " +
"FROM fe_mainmenu as fmm " +
"WHERE Visibility = 1 " +
"ORDER BY Priority DESC";
//DB Execute Query
MySqlCommand DB_CMD = new MySqlCommand(DB_QUERY, DB_Connection);
//DB get mainMenu
using (MySqlDataReader DB_RDR = DB_CMD.ExecuteReader())
{
if (DB_RDR.HasRows)
{
while (DB_RDR.Read())
{
}
DB_RDR.Close();
}
}
I have in my html code a var called : menuItems
So i wanne full this var with the menu items. Can you help me and put
me in the right direction?
Dynamically populating menu items from the database in ASP.NET
Please mark you thread resolved using the Thread Tools as shown
-
Sep 12th, 2012, 05:58 AM
#4
Lively Member
Re: Problem main / submenu without menuControls
"The problem that I have
is that i wanne build my main and submenu without the asp menu
controls"
He explicitly stated he doesnt want to use the "menu control" as per this article. Some kind of dynamic html building, I would probably build it up as a literal string and fire it off that way
-
Sep 12th, 2012, 06:12 AM
#5
Re: Problem main / submenu without menuControls
 Originally Posted by Joshwah!
"The problem that I have
is that i wanne build my main and submenu without the asp menu
controls"
He explicitly stated he doesnt want to use the "menu control" as per this article. Some kind of dynamic html building, I would probably build it up as a literal string and fire it off that way
OOPS. Sorry for that. Then he can take the help of the JQuery. Jquery helps to create awesome menus. And here is one example
Please mark you thread resolved using the Thread Tools as shown
-
Sep 12th, 2012, 07:49 AM
#6
Thread Starter
Member
Re: Problem main / submenu without menuControls
Thank you for the comments, I know that the query * is not verry smart , it's just for now
I will change that later on.
I don't need the jquery, because i have already the menu structure using only html and css.
The problem that I can read the data but I need to build the structure :
Menu
-- Submenu 1
-- Submenu 2
-
Sep 12th, 2012, 08:13 AM
#7
Lively Member
Re: Problem main / submenu without menuControls
Is the table data held like so?
ID Menu_Item Parent Parent_ID Hierarchy
1 Home 1 1 1
2 Settings 1 2 1
3 Extra Settings 0 2 2
-
Sep 12th, 2012, 08:25 AM
#8
Lively Member
Re: Problem main / submenu without menuControls
Actually, this is crazy, what you want to do is impossible in HTML and CSS only if you have already built the menu without any client side code
Looking at your previous posts it's pretty clear you are very new to ASP.net (How to insert values into a database for example you have asked for help with) so at risk of sounding rude are you expecting to be able to modify HTML code on the fly easily from aspx.cs codebehind, as it's not that easy. Is there a reason you don't want to use the ASP menu controls.
Cheers,
Joshua
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|