Results 1 to 8 of 8

Thread: Problem main / submenu without menuControls

  1. #1
    Member
    Join Date
    Jul 07
    Posts
    62

    Question 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?

  2. #2
    Lively Member
    Join Date
    Apr 10
    Location
    York, Uk
    Posts
    103

    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.

  3. #3
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 04
    Location
    VBForums
    Posts
    5,815

    Re: Problem main / submenu without menuControls

    Quote Originally Posted by domentarion View Post
    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



    Windows 8 Developer Preview Available For Download
    www.techreceipe.com




  4. #4
    Lively Member
    Join Date
    Apr 10
    Location
    York, Uk
    Posts
    103

    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

  5. #5
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 04
    Location
    VBForums
    Posts
    5,815

    Re: Problem main / submenu without menuControls

    Quote Originally Posted by Joshwah! View Post
    "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



    Windows 8 Developer Preview Available For Download
    www.techreceipe.com




  6. #6
    Member
    Join Date
    Jul 07
    Posts
    62

    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

  7. #7
    Lively Member
    Join Date
    Apr 10
    Location
    York, Uk
    Posts
    103

    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

  8. #8
    Lively Member
    Join Date
    Apr 10
    Location
    York, Uk
    Posts
    103

    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
  •