Esempio n. 1
0
        private void LoadMenu()
        {
            string nURL = Request.Url.AbsolutePath;

            string[]  _MenuModule = nURL.Split('/');
            int       nKey        = 0;
            string    _Title      = "";
            DataTable _Table      = Web_Menu_Data.List(0);

            StringBuilder nMenuTop = new StringBuilder();

            nMenuTop.AppendLine("<ul>");
            nMenuTop.AppendLine("<li class='space'></li>");
            foreach (DataRow nRow in _Table.Rows)
            {
                if (_MenuModule[1].ToUpper() == nRow["Module"].ToString().ToUpper())
                {
                    nMenuTop.AppendLine("<li class='selected'><img src='/Img/Menu/" + nRow["Icon"] + "_selected.png'/></li>");
                    nKey   = int.Parse(nRow["MenuKey"].ToString());
                    _Title = nRow["MenuName"].ToString();
                }
                else
                {
                    nMenuTop.AppendLine("<li><a href='" + nRow["MenuLink"] + "'><img src='/Img/Menu/" + nRow["Icon"] + ".png'/></a></li>");
                }
                nMenuTop.AppendLine("<li class='space'></li>");
            }
            nMenuTop.AppendLine("</ul>");
            txtTitleCategory.Text = _Title;
            LiteMenuTop.Text      = nMenuTop.ToString();
            LoadMenuSub(nKey);
        }
Esempio n. 2
0
        private void LoadMenuSub(int Parent)
        {
            StringBuilder nMenuSub     = new StringBuilder();
            DataTable     _Table       = Web_Menu_Data.List(Parent);
            string        MenuIDActive = "";

            foreach (DataRow nRow in _Table.Rows)
            {
                int Key = Convert.ToInt32(nRow["MenuKey"]);

                DataTable _TableSub = Web_Menu_Data.List(Key);

                if (_TableSub.Rows.Count > 0)
                {
                    nMenuSub.AppendLine("<div id='Show" + nRow["MenuID"].ToString() + "' class='ListItemParent' onclick='SetMenuParent(this.id)'>" + nRow["MenuName"].ToString() + "</div>");
                    nMenuSub.AppendLine("<div class='Line2' style='clear: both'></div>");
                    nMenuSub.AppendLine("<div id='ViewShow" + nRow["MenuID"].ToString() + "' class='Categories' style='display:none'>");
                    nMenuSub.AppendLine("<ul>");
                    foreach (DataRow nRowSub in _TableSub.Rows)
                    {
                        if (nRowSub["MenuLink"].ToString() == Request.Url.AbsolutePath)
                        {
                            nMenuSub.AppendLine("<li class='ItemSubActivate' id='MenuKey_" + nRowSub["MenuKey"].ToString() + "' onclick='SetStatusLayer(this.id," + nRowSub["MenuKey"].ToString() + ")' >" + nRowSub["MenuName"].ToString() + "</li>");
                            MenuIDActive = "Show" + nRow["MenuID"].ToString();
                        }
                        else
                        {
                            nMenuSub.AppendLine("<li class='ItemSub' id='MenuKey_" + nRowSub["MenuKey"].ToString() + "' onclick='SetStatusLayer(this.id," + nRowSub["MenuKey"].ToString() + ")' ><a href='" + nRowSub["MenuLink"].ToString() + "'>" + nRowSub["MenuName"].ToString() + "<a></li>");
                        }
                    }
                    nMenuSub.AppendLine("</ul>");
                    nMenuSub.AppendLine("<div class='Line2' style='clear: both'></div>");
                    nMenuSub.AppendLine("</div>");
                }
            }
            StringBuilder nMenuActivate = new StringBuilder();

            nMenuActivate.AppendLine("<script type='text/javascript'>");
            nMenuActivate.AppendLine("$(document).ready(function () {");
            nMenuActivate.AppendLine("SetMenuParent('" + MenuIDActive + "')");
            nMenuActivate.AppendLine(" }); </script>");
            LiteMenuSub.Text       = nMenuSub.ToString();
            LiteSetMenuActive.Text = nMenuActivate.ToString();
            // txtTitleCategory.Text = Request.Url.AbsolutePath;
        }