Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5930623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:34:48+00:00 2026-05-22T14:34:48+00:00

I have to create a menu bar for my web application. I don’t know

  • 0

I have to create a menu bar for my web application. I don’t know how to create it. I came across few sites and downloaded some sample code. I have created a master page for this and pasted the code below for creating the menu which I have used.

 [MethodImpl(MethodImplOptions.Synchronized)]
public override SiteMapNode BuildSiteMap()
{
    // Return immediately if this method has been called before
    if (_root != null)
        return _root;

    // Create a dictionary for temporary node storage and lookup
    Dictionary<int, SiteMapNode> nodes = new Dictionary<int, SiteMapNode> (16);


    // Query the database for site map nodes
    using (SqlConnection connection = new SqlConnection(ConfigurationManager.AppSettings["SQLConnectionString"]))
        {
        connection.Open();
        SqlCommand command = new SqlCommand("SELECT ID, Title, Description, Url, Roles, Parent FROM ven_sitemap ORDER BY ID", connection);
        SqlDataReader reader = command.ExecuteReader ();
        int id = reader.GetOrdinal("ID");
        int url = reader.GetOrdinal ("Url");
        int title = reader.GetOrdinal ("Title");
        int desc = reader.GetOrdinal("Description");
        int roles = reader.GetOrdinal ("Roles");
        int parent = reader.GetOrdinal("Parent");

        while (reader.Read())
        {
            // Create the root SiteMapNode

            // Build a tree of SiteMapNodes underneath the root node
            //while (reader.Read())
            //{
            if (reader["parent"].ToString() == "0")
            {
                _root = new SiteMapNode(this, reader.GetInt32(id).ToString(), reader.IsDBNull(url) ? null : reader.GetString(url),
                    reader.GetString(title), reader.IsDBNull(desc) ? null : reader.GetString(desc));


                if (!reader.IsDBNull(roles))
                {
                    string rolenames = reader.GetString(roles).Trim();
                    if (!String.IsNullOrEmpty(rolenames))
                    {
                        string[] rolelist = rolenames.Split(new char[] { ',', ';' }, 512);
                        _root.Roles = rolelist;
                    }
                }

                //  Add "*" to the roles list if no roles are specified
                if (_root.Roles == null)
                    _root.Roles = new string[] { "*" };

                // Record the root node in the dictionary
                if (nodes.ContainsKey(reader.GetInt32(id)))
                    throw new ConfigurationErrorsException(_errmsg2); // ConfigurationException pre-Beta 2
                nodes.Add(reader.GetInt32(id), _root);

                // Add the node to the site map
                AddNode(_root, null);
            }

            else
                {
                    SiteMapNode node = new SiteMapNode(this, reader.GetInt32(id).ToString(), reader.IsDBNull(url) ? null : reader.GetString(url),
                        reader.GetString(title), reader.IsDBNull(desc) ? null : reader.GetString(desc));

                    if (!reader.IsDBNull(roles))
                    {
                        string rolenames = reader.GetString(roles).Trim();
                        if (!String.IsNullOrEmpty(rolenames))
                        {
                            string[] rolelist = rolenames.Split(new char[] { ',', ';' }, 512);
                            node.Roles = rolelist;
                        }
                    }

                    // If the node lacks roles information, "inherit" that
                    // information from its parent

                    SiteMapNode parentnode = nodes[reader.GetInt32(parent)];
                    if (node.Roles == null)
                        node.Roles = parentnode.Roles;


                    // Record the node in the dictionary
                    if (nodes.ContainsKey(reader.GetInt32(id)))
                        throw new ConfigurationErrorsException(_errmsg2);
                    nodes.Add(reader.GetInt32(id), node);

                    // Add the node to the site map
                    AddNode(node, parentnode);
                }
            //}
        }
    }

    // Return the root SiteMapNode
    return _root;


}

protected override SiteMapNode GetRootNodeCore ()
{
    BuildSiteMap ();
    return _root;
}

My table :

ID  Title   Description          Url                   Roles    Parent

 1  HOME    NULL    ~/Reports/Production_data_report.aspx   2   0
 2  Machinename NULL    ~/Reports/machine_name.aspx         3     1
 3  Business Quote  NULL    ~/Reports/business_quote.aspx   2   1
 6  Machine Counter NULL    ~/Reports/machine_counter.aspx  1   0
 7  Data Query  NULL    ~/Reports/data_query_page.aspx   2  6
 8  Production Report   NULL    ~/Reports/yoneda_report.aspx    2   6

Output from the code:

Machine counter
  Data query
  Production Report

But I need to have output like this,

  Home             Machine counter
  machinename        Data query
  businessquote       Production Report

Where home and machine counter are root nodes. When I execute the above code my first root node is replaced by the second one.

Please help me solve this issue.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T14:34:49+00:00Added an answer on May 22, 2026 at 2:34 pm

    i have used css and html to meet my requirement.. i have removed all my server side coding..

    coding :

      <ul id="topnav" style="left: 24px; width: 95%; position: absolute; top: 86px">
        <li class ="admin" style="background-color:#FF9900; left: 0px; top: 0px;">
            <h4>
                &nbsp; &nbsp;&nbsp; ADMIN &nbsp; &nbsp; 
            </h4>
             <div class="sub">
                <ul>
                    <li><h2><a href="#">ADD MACHINE</a></h2></li>
                    <li><h2><a href="#">ADD JOB</a></h2></li>
    
                </ul>
             </div>
        </li>
        <li class ="report" style="background-color:#ff9933; left: 154px; top: 0px;">
            <h4 style="background-color: #ff9933">
                &nbsp;&nbsp; REPORT &nbsp; &nbsp; &nbsp;
            </h4>
            <div class="sub">
                <ul>
                    <li style ="color:Red;"><h2>MACHINE REPORT</h2></li>
                    <li style="visibility:hidden;"><a href="#">PRODUCTION REPORT</a></li>
    
                </ul>
                <ul>
                    <li style ="color:Red;"><h2>TIME SHEET</h2></li>
                    <li ><a href="#">ASSEMBLY</a></li>
                    <li><a href="#">MAINTENANCE</a></li>
                    <li><a href="#">CNC</a></li>
                    <li><a href="#">DESIGN</a></li>
    
                </ul>
                <ul>
                    <li style ="color:Red;"><h2>MACHINE COUNTER</h2></li>
                    <li><a href="#">MACHINE COUNTER</a></li>
                </ul>
    
            </div>
        </li>
        <li class ="business" style="left: -100px; top: 0px; height: 38px; background-color: #ff9933" >
            <h4>
                &nbsp;&nbsp; BUSINESS &nbsp;
            </h4>
             <div class="sub">
                <ul>
                    <li><h2><a href="#">BUSINESS QOUTE</a></h2></li>
                    <li><h2><a href="#">BUSINESS AWARD </a></h2></li>
    
                </ul>
             </div>
         <!--
        <li>
            Store Locator
        </li>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a menu bar for my application. I have created
I have a menu bar and I want to create a div for each
Hi I want to create a flex web page. Basically I have some menubaritems
I am developing a web application in ASP.NET. The menu/ navigation bar is at
I have an application which resides in menu bar, pretty much like this one
I have a main menu with an action bar. On create, I run a
I am trying to create a simple GUI. I have a menu bar that
I have created a menu and submenu bar for my web app. Now with
I have created a status item (menu bar item) for my app, but at
Here's my problem: I have do create a menu/list of actions (which would be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.