private void BindGrid()
        {
            Maticsoft.BLL.tPictureType BLL = new Maticsoft.BLL.tPictureType();

            TMailList.Nodes.Clear();
            DataSet ds = BLL.GetList(" id>0  order by Sort desc");

            ds.Relations.Add("TreeRelation", ds.Tables[0].Columns["id"], ds.Tables[0].Columns["FatherId"], false);



            foreach (DataRow row in ds.Tables[0].Rows)
            {
                if (row["FatherId"].ToString() == "0")
                {
                    FineUIPro.TreeNode node = new FineUIPro.TreeNode();
                    node.NodeID   = row["id"].ToString();
                    node.Text     = row["Name"].ToString();
                    node.Expanded = true;
                    if (row.GetChildRows("TreeRelation").Length <= 0)
                    {
                        node.ToolTip = "可选择";
                    }
                    else
                    {
                        node.ToolTip = "不可选择";
                    }
                    node.EnableClickEvent = true;
                    TMailList.Nodes.Add(node);
                    ResolveSubTree(row, node);
                }
            }
        }
        protected void GridDpt_RowCommand(object sender, GridCommandEventArgs e)
        {
            int PicId = GetSelectedDataKeyID(GridDpt);


            if (e.CommandName == "Delete")
            {
                BLL.tPictureType BLL = new Maticsoft.BLL.tPictureType();

                bool isTrue = BLL.Delete(PicId);

                if (!isTrue)
                {
                    Alert.ShowInTop("删除失败!");
                    return;
                }
                else
                {
                    LoadData();
                }
            }
            else
            {
                Window1.Title = "分类编辑";
                string openUrl = String.Format("./PicEdit.aspx?PicId={0}", HttpUtility.UrlEncode(PicId.ToString()));
                PageContext.RegisterStartupScript(Window1.GetSaveStateReference(PicId.ToString()) + Window1.GetShowReference(openUrl));
            }
        }
        private void BindGrid()
        {
            Maticsoft.BLL.tPictureType bll = new Maticsoft.BLL.tPictureType();
            DataSet ds = bll.GetList("");

            ds.Relations.Add("TreeRelation", ds.Tables[0].Columns["Id"], ds.Tables[0].Columns["FatherId"], false);
            ddlfatherId.Items.Clear();
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                if (row["FatherId"].ToString() == "0")
                {
                    FineUIPro.ListItem it = new FineUIPro.ListItem();
                    it.Text              = row["Name"].ToString();
                    it.Value             = row["Id"].ToString();
                    it.SimulateTreeLevel = 1;
                    if (row.GetChildRows("TreeRelation").Length <= 0)
                    {
                        it.EnableSelect = true;
                    }
                    else
                    {
                        it.EnableSelect = false;
                    }
                    ddlfatherId.Items.Add(it);
                    ResolveSubTree(row, ddlfatherId);
                }
            }
        }
        protected void LoadData()
        {
            Maticsoft.BLL.tPictureType BLL = new Maticsoft.BLL.tPictureType();
            string sortField     = GridDpt.SortField;
            string sortDirection = GridDpt.SortDirection;

            GridDpt.RecordCount = BLL.GetRecordCount("");
            DataView view = BLL.GetListByPage("", "", GridDpt.PageIndex * GridDpt.PageSize, (GridDpt.PageIndex + 1) * GridDpt.PageSize).Tables[0].DefaultView;

            view.Sort          = String.Format("{0} {1}", sortField, sortDirection);
            GridDpt.DataSource = view.ToTable();
            GridDpt.DataBind();
        }
 protected string GetName(string Tid)
 {
     Maticsoft.BLL.tPictureType BLL = new Maticsoft.BLL.tPictureType();
     return(BLL.GetModel(int.Parse(Tid)).Name);
 }