Return to Snippet

Revision: 2387
at February 7, 2007 05:45 by gndprx


Updated Code
//---------------------------------------
//CSS Code
dl, dt, dd{
margin: 0;
padding: 0;
list-style-type: none;
}

.smenu, .smenu li {
margin: 0;
padding: 0;
list-style-type: none;
}

#menu2 {
}

dl#menu2 {
width: 150px;
}

dl#menu2 dt {
cursor: pointer;
margin: 2px;
padding: 1px 5px 1px 5px;
text-align: left;
font-weight: bold;
background: url(../images/menu_bg2.png) no-repeat;
padding-bottom: 5px;
}

dl#menu2 dt:hover {
background: url(../images/menu_bg3.png) no-repeat;
color: #fff;
}

dl#menu2 a:hover {
color:#fff;
}

dl#menu2 dd li {
padding-bottom: 2px;
}

dl#menu2 ul { margin:0px; padding:0px;}

dl#menu2 li {
text-align: left;
padding: 1px 5px 1px 20px;
width: 120px;
}

dl#menu2 li a, dl#menu2 dt a {
color: #006685;
text-decoration: none;
height: 100%;
}

dl#menu2 li:hover {
background: #729dc9;
}
//---------------------------------------

//---------------------------------------
// Jscript component to expand/collapse
    window.onload=expand;
    function expand(id) {
    var d = document.getElementById(id);
      for (var i = 1; i<=10; i++) {
        if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
      }
    if (d) {d.style.display='block';}
    }
//---------------------------------------

//---------------------------------------
//DB Table Requirements
//menuID, menuItem, menuLink, parentMenuID, displayOrder, publishDate, expDate
//---------------------------------------

//---------------------------------------
//.Net 2.0 Code to put menu into a Label
//Build and output main left bar navigation
        someTableAdapters.parentMenuTableAdapter menuAdapter = new someTableAdapters.parentMenuTableAdapter();
        some_Menu.parentMenuDataTable parentItems;
        parentItems = menuAdapter.GetData();
        int x = 1;
        LeftMenu.Text = "<dl id=\"menu2\">\n";
        foreach (some_Menu.parentMenuRow menuRow in parentItems)
        {
            LeftMenu.Text = LeftMenu.Text + "<dt onclick=\"javascript:expand('smenu" + x +"');\">» <a href=\"#\">" + menuRow.menuItem + "</a></dt>";
            
        #region Sub Menu
            someTableAdapters.subMenuTableAdapter subAdapter = new someTableAdapters.subMenuTableAdapter();
            some_Menu.subMenuDataTable subItems;
            subItems = subAdapter.GetData(menuRow.menuID);
            LeftMenu.Text = LeftMenu.Text + "<dd id=\"smenu" + x + "\">\n";
            LeftMenu.Text = LeftMenu.Text + "<ul class=\"smenu\">\n";
            foreach (some_Menu.subMenuRow subRow in subItems)
            {
                LeftMenu.Text = LeftMenu.Text + "<li><a href=\"" + subRow.menuLink + "\">" + subRow.menuItem + "</a></li>\n";
            }
            LeftMenu.Text = LeftMenu.Text + "</ul></dd>\n";
        #endregion
            x++;
        }
        LeftMenu.Text = LeftMenu.Text + "</dl>";
//---------------------------------------

Revision: 2386
at February 7, 2007 05:40 by gndprx


Initial Code
//---------------------------------------
//CSS Code
dl, dt, dd{
margin: 0;
padding: 0;
list-style-type: none;
}

.smenu, .smenu li {
margin: 0;
padding: 0;
list-style-type: none;
}

#menu2 {
}

dl#menu2 {
width: 150px;
}

dl#menu2 dt {
cursor: pointer;
margin: 2px;
padding: 1px 5px 1px 5px;
text-align: left;
font-weight: bold;

/* Revision 2 menu SG */
background: url(../images/menu_bg2.png) no-repeat;
padding-bottom: 5px;

/* Original Menu */
/* border: 1px solid #729dc9;
background: #fff;
filter:alpha(opacity=90);
opacity: 0.9;
-moz-opacity:0.9;*/
}

dl#menu2 dt:hover {
background: url(../images/menu_bg3.png) no-repeat;
color: #fff;
}

dl#menu2 a:hover {
color:#fff;
}

dl#menu2 dd li {
padding-bottom: 2px;
}

dl#menu2 ul { margin:0px; padding:0px;}

dl#menu2 li {
text-align: left;
padding: 1px 5px 1px 20px;
width: 120px;
}

dl#menu2 li a, dl#menu2 dt a {
color: #006685;
text-decoration: none;
height: 100%;
}

dl#menu2 li:hover {
background: #729dc9;
}
//---------------------------------------

//---------------------------------------
// Jscript component to expand/collapse
    window.onload=expand;
    function expand(id) {
    var d = document.getElementById(id);
      for (var i = 1; i<=10; i++) {
        if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
      }
    if (d) {d.style.display='block';}
    }
//---------------------------------------

//---------------------------------------
//DB Table Requirements
//menuID, menuItem, menuLink, parentMenuID, displayOrder, publishDate, expDate
//---------------------------------------

//---------------------------------------
//.Net 2.0 Code to put menu into a Label
//Build and output main left bar navigation
        someTableAdapters.parentMenuTableAdapter menuAdapter = new someTableAdapters.parentMenuTableAdapter();
        some_Menu.parentMenuDataTable parentItems;
        parentItems = menuAdapter.GetData();
        int x = 1;
        LeftMenu.Text = "<dl id=\"menu2\">\n";
        foreach (some_Menu.parentMenuRow menuRow in parentItems)
        {
            LeftMenu.Text = LeftMenu.Text + "<dt onclick=\"javascript:expand('smenu" + x +"');\">&raquo;&nbsp;<a href=\"#\">" + menuRow.menuItem + "</a></dt>";
            
        #region Sub Menu
            someTableAdapters.subMenuTableAdapter subAdapter = new someTableAdapters.subMenuTableAdapter();
            some_Menu.subMenuDataTable subItems;
            subItems = subAdapter.GetData(menuRow.menuID);
            LeftMenu.Text = LeftMenu.Text + "<dd id=\"smenu" + x + "\">\n";
            LeftMenu.Text = LeftMenu.Text + "<ul class=\"smenu\">\n";
            foreach (some_Menu.subMenuRow subRow in subItems)
            {
                LeftMenu.Text = LeftMenu.Text + "<li><a href=\"" + subRow.menuLink + "\">" + subRow.menuItem + "</a></li>\n";
            }
            LeftMenu.Text = LeftMenu.Text + "</ul></dd>\n";
        #endregion
            x++;
        }
        LeftMenu.Text = LeftMenu.Text + "</dl>";
//---------------------------------------

Initial URL

                                

Initial Description

                                

Initial Title
CSS / SQL / .NET menu bar

Initial Tags
css

Initial Language
C#