Exemple #1
0
        /// <summary>
        /// 显示菜单
        /// </summary>
        /// <param name="parentNodeID"></param>
        private void ShowMenu(long parentNodeID)
        {
            if (CheckIsExistChild(parentNodeID))
            {
                DataTable dt = WebInfoLogic.GetParentName(parentNodeID);

                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (CheckIsExistChild(ConvertHelper.ConvertLong(dt.Rows[i]["InfoCategoryID"].ToString())))
                        {
                            //strMenu.Append(string.Format("<div class=\"list_li\" style=\"cursor:pointer\" onclick=\"ShowMenu('{3}')\"><a href=\"info.aspx?InfoCategoryID={0}&CategoryID={2}\">{1}",

                            //   dt.Rows[i]["InfoCategoryID"].ToString(), dt.Rows[i]["InfoCategoryName"].ToString(), dt.Rows[i]["InfoCategoryID"].ToString(), dt.Rows[i]["InfoCategoryID"].ToString()) + "</a></div>");

                            strMenu.Append(string.Format("<div class=\"list_li\" style=\"cursor:pointer\"><a href=\"info.aspx?InfoCategoryID={0}&CategoryID={2}\">{1}",

                                                         dt.Rows[i]["InfoCategoryID"].ToString(), dt.Rows[i]["InfoCategoryName"].ToString(), dt.Rows[i]["InfoCategoryID"].ToString()) + "</a></div>");
                        }
                        if (ConvertHelper.ConvertLong(dt.Rows[i]["InfoCategoryID"].ToString()) != 0)
                        {
                            if (CheckIsExistChild(ConvertHelper.ConvertLong(dt.Rows[i]["InfoCategoryID"].ToString())))
                            {
                                LoadChildMenu(ConvertHelper.ConvertLong(dt.Rows[i]["InfoCategoryID"].ToString()));
                            }
                            else
                            {
                                ShowMenu(ConvertHelper.ConvertLong(dt.Rows[i]["InfoCategoryID"].ToString()));
                            }
                        }
                    }
                }
            }
            else
            {
                DataTable dtName = WebInfoLogic.GetCategoryName(parentNodeID);
                strMenu.Append(string.Format("<div class=\"list_li\"><a href=\"info.aspx?InfoCategoryID={0}&CategoryID={2}\">{1}</a></div>",
                                             InfoCategoryID.ToString(), dtName.Rows[0]["InfoCategoryName"].ToString(), parentNodeID.ToString()));
            }
            leftName.InnerHtml = strMenu.ToString();
        }