SDmenu滑动菜单获取导航连接部分代码

   <%
                    LOM.CommonOper.CommonOper common = new LOM.CommonOper.CommonOper();
                    if (Session["userid"] == null)
                    {
                        Response.Redirect(common.GetUrl(1)+"/Default.aspx");
                    }
                    else
                    {
                        string userid = Session["USERID"].ToString();
                        string connection = Connection.ConnectionStringIIP;
                        string sql = "select * from V_USERINFO where userid='" + userid + "' order by id";
                        SqlConnection sqlconnection = new SqlConnection(connection);
                        DataSet ds = new DataSet();
                        sqlconnection.Open();
                        SqlDataAdapter command = new SqlDataAdapter(sql, sqlconnection);
                        command.Fill(ds, "ds");
                        sqlconnection.Close();
                        #region//验证页面用户有权访问,无权访问的页面返回上一页面
                        if (ConfigurationManager.AppSettings["SysId"].ToString() == "1")//非本地调试
                        {
                            BLL.ManageSys.ManageSysUrl B_Sys = new BLL.ManageSys.ManageSysUrl();
                            string strFilePath = Request.FilePath;
                            DataRow[] drArray = ds.Tables[0].Select("purl like '%" + strFilePath + "%'");
                            if (!(drArray.Length > 0))
                            {
                                //没有权限访问页面重新登陆
                                Session.Abandon();
                                Response.Redirect(B_Sys.GetUrl(Convert.ToDecimal(ConfigurationManager.AppSettings["SysId"].ToString())) + "/Default.aspx");
                                //没有权限访问页面返回上一页面
                                MsgBox msgBox = new MsgBox();
                                msgBox.AjaxResponeSrciptAndBack(this, this.GetType(), "你没有权限访此页面!");
                            }
                        }
                        #endregion
                        string[] gmid = new string[500];
                        bool flag = true;
                        int j = 0;

                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            foreach (DataRow item in ds.Tables[0].Rows)
                            {
                                flag = true;
                                if (j == 0)
                                {
                                    gmid[j] = item["fgname"].ToString();
                                }
                                else
                                {
                                    for (int k = 0; k < j; k++)
                                        if (item["fgname"].ToString().Equals(gmid[k]))
                                        {
                                            flag = false;
                                            break;
                                        }
                                }
                                if (flag == true)
                                {
                                    if (j != 0)
                                    {
                                        gmid[j] = item["fgname"].ToString();
                                    }
                                    j++;
                                    string html = "";
                                    string classpath = "class="collapsed"";
                                    html = "<div  " + classpath + "> <span>" + item["fgname"].ToString() + "</span>";
                                    foreach (DataRow litem in ds.Tables[0].Select("fgname = '" + item["fgname"].ToString() + "'"))
                                    {
                                        if (Connection.ConnectionStringIIP != Connection.ConnectionString)
                                        {
                                            if (item["SysUrl"] != DBNull.Value && item["SysUrl"].ToString().Trim() != "" && item["purl"].ToString().Trim() != "" && item["purl"] != DBNull.Value)
                                            {
                                                string StrPURL = litem["PURL"].ToString();
                                                if (StrPURL.Contains(".."))
                                                {
                                                    StrPURL = StrPURL.Replace("..", "");
                                                }
                                                if (StrPURL == "/")
                                                {
                                                    html = html + "<a href='" + litem["SysUrl"].ToString() + StrPURL + "'" + "target='_blank'" + ">" + litem["mname"].ToString() + "</a>";
                                                }
                                                else
                                                {
                                                    html = html + "<a href='" + litem["SysUrl"].ToString() + StrPURL + "'>" + litem["mname"].ToString() + "</a>";
                                                }
                                            }
                                        }
                                        else
                                        {
                                            html = html + "<a href='" + litem["purl"].ToString() + "'>" + litem["mname"].ToString() + "</a>";
                                        }
                                    }
                                    html = html + "</div>";
                                    Response.Write(html);
                                }
                            }
                        }
                    }            
 
                %>
原文地址:https://www.cnblogs.com/ymecho/p/3280959.html