예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("\n<script Type='text/javascript'>").Append("\n");
                sb.Append("<!--").Append("\n");
                sb.Append("d = new dTree('d');").Append("\n");
                sb.Append("d.config.closeSameLevel=true;");

                //读取数据
                KingTop.BLL.SysManage.WebSiteTemplateNode bll = new KingTop.BLL.SysManage.WebSiteTemplateNode();
                DataTable dt = bll.GetList("WEBSITE", Utils.getOneParams(TemplateID));

                if (dt != null)
                {
                    try
                    {
                        string stremp2  = dt.Rows.Count.ToString();
                        string parentid = "";
                        foreach (DataRow dr in dt.Rows)
                        {
                            if (dr["NodeCode"].ToString().Length <= 3)
                            {
                                parentid = "-1";
                            }
                            else
                            {
                                parentid = dr["NodeCode"].ToString().Substring(0, dr["NodeCode"].ToString().Length - 3);
                            }
                            string strPer = "&nbsp;&nbsp;<a HREF=TemplateNodeEdit.aspx?Action=New&TemplateID=" + TemplateID + "&NodeCode=" + dr["NodeCode"] + "&IsFolder=" + dr["NodeType"] + "&Nodeid=" + NodeID + "><img SRC=../images/folder.gif border=0 alt=添加子栏目></a>&nbsp;&nbsp;<a HREF=TemplateNodeEdit.aspx?Action=Edit&ID=" + dr["ID"] + "&TemplateID=" + TemplateID + "&NodeCode=" + dr["NodeCode"] + "><img SRC=../images/pen.gif border=0 alt=修改></a>";
                            //if (parentid == "-1")
                            //{
                            //    sb.Append("d.add(").Append(dr["NodeCode"]).Append(",")
                            //        .Append(parentid).Append(",'").Append(dr["NodeName"])
                            //        .Append("');").Append("\n");
                            //}
                            //else
                            //{
                            sb.Append("d.add(").Append(dr["NodeCode"]).Append(",")
                            .Append(parentid).Append(",'").Append(dr["NodeName"]).Append(strPer)
                            .Append("');").Append("\n");
                            //}
                        }
                    }
                    catch (Exception err)
                    {
                        string stremp = err.Message;
                    }
                }

                sb.Append("document.write(d);").Append("\n");
                //打开所有节点
                sb.Append(" d.openAll();").Append("\n");
                sb.Append("//-->").Append("\n");
                sb.Append("</script>").Append("\n");
                menutree.InnerHtml = sb.ToString();
            }
        }