コード例 #1
0
        protected void Pg_Init()
        {
            ArrayList fieldName  = new ArrayList();
            ArrayList fieldValue = new ArrayList();

            ArrayList selName  = new ArrayList();
            ArrayList selValue = new ArrayList();
            string    param    = string.Empty;
            int       cid      = 0;

            if (CommonLibrary.CommOperate.GetStrFromRequestQueryString("pid") != null && CommonLibrary.CommOperate.GetStrFromRequestQueryString("pid") != "")
            {
                fieldName.Add("pid");
                fieldValue.Add(CommonLibrary.CommOperate.GetStrFromRequestQueryString("pid"));
                selName.Add("ParentID");
                cid = 0;
                Int32.TryParse(CommonLibrary.CommOperate.GetStrFromRequestQueryString("pid"), out cid);

                selValue.Add(cid);
            }
            else if (CommonLibrary.CommOperate.GetStrFromRequestQueryString("keyword") != null && CommonLibrary.CommOperate.GetStrFromRequestQueryString("keyword") != "")
            {
                fieldName.Add("keyword");
                fieldValue.Add(CommonLibrary.CommOperate.GetStrFromRequestQueryString("keyword"));
                selName.Add("NodeName");
                selValue.Add(CommonLibrary.CommOperate.GetStrFromRequestQueryString("keyword"));
            }
            else
            {
                fieldName  = null;
                fieldValue = null;
                selName.Add("ParentID");
                selValue.Add(0);
            }

            int currentPage, pageSize, pageCount = 1, recordCount = 0;

            pageSize = 15;

            recordCount = nodebll.GetNodeCounts(selName, selValue);

            currentPage = tool.PageAndCount.GetCurrent(recordCount, pageSize);
            int startId = tool.PageAndCount.StartID(currentPage, pageSize);
            int endId   = tool.PageAndCount.EndID(currentPage, pageSize);

            GridView1.DataSource   = nodebll.GetNodeByCondition(selName, selValue, "  SortID asc,NodeId desc", startId, endId);
            GridView1.DataKeyNames = new String[] { "NodeId" };
            GridView1.DataBind();

            TBLL.NodeBLL NodeOperate = new NodeBLL();
            lbl_CurrentNode.Text = NodeTree.GetNodePath(NodeOperate.GetNode(cid).NodePath);
            PagerClass.PageSet ps = new PagerClass.PageSet(currentPage, recordCount, pageSize, fieldName, fieldValue);
            L_page.Text = ps.GeneratePagers();
        }