获得TreeNode的索引 - FineUITreeNodeIndex

2017-02-21 21:51:48  访问(1580) 赞(0) 踩(0)


        /// <summary>
        /// 获得TreeNode的索引 - FineUITreeNodeIndex
        /// </summary>
        /// <param name="extAspNetTree"></param>
        /// <param name="extAspNetTreeNode"></param>
        /// <returns></returns>
        public static int FineUITreeNodeIndex
            (
                FineUI.Tree extAspNetTree, 
                FineUI.TreeNode extAspNetTreeNode
            )
        {
            if (extAspNetTree == null)
            {

                throw new Exception
                    (
                        "方法:"
                        + MethodBase.GetCurrentMethod().ReflectedType.FullName
                        + " "
                        + MethodBase.GetCurrentMethod().ToString()
                        + " 发生异常:"
                        + "传入参数:"
                        + "FineUI.Tree extAspNetTree"
                        + "为null。"
                    );
            }

            if (extAspNetTreeNode == null)
            {

                throw new Exception
                    (
                        "方法:"
                        + MethodBase.GetCurrentMethod().ReflectedType.FullName
                        + " "
                        + MethodBase.GetCurrentMethod().ToString()
                        + " 发生异常:"
                        + "传入参数:"
                        + "FineUI.TreeNode extAspNetTreeNode"
                        + "为null。"
                    );
            }

            int iCount = extAspNetTree.Nodes.Count;

            for (int i = 0; i < iCount; ++i)
            {
                if (extAspNetTreeNode == extAspNetTree.Nodes[i])
                    return i;

            }

            return -1;
        }

        /// <summary>
        /// 获得TreeNode的索引
        /// </summary>
        /// <param name="extAspNetTree"></param>
        /// <param name="extAspNetTreeNodeID"></param>
        /// <returns></returns>
        public static int FineUITreeNodeIndex(FineUI.Tree extAspNetTree, string extAspNetTreeNodeID)
        {

            if (extAspNetTree == null)
            {

                throw new Exception
                    (
                        "方法:"
                        + MethodBase.GetCurrentMethod().ReflectedType.FullName
                        + " "
                        + MethodBase.GetCurrentMethod().ToString()
                        + " 发生异常:"
                        + "传入参数:"
                        + "FineUI.Tree extAspNetTree"
                        + "为null。"
                    );
            }

            if (extAspNetTreeNodeID == null)
            {

                throw new Exception
                    (
                        "方法:"
                        + MethodBase.GetCurrentMethod().ReflectedType.FullName
                        + " "
                        + MethodBase.GetCurrentMethod().ToString()
                        + " 发生异常:"
                        + "传入参数:"
                        + "string extAspNetTreeNodeID"
                        + "为null。"
                    );
            }

            int iCount = extAspNetTree.Nodes.Count;

            for (int i = 0; i < iCount; ++i)
            {
                if (extAspNetTreeNodeID == extAspNetTree.Nodes[i].NodeID)
                    return i;

            }

            return -1;
        }


标签:获得TreeNode的索引 - FineUITreeNodeIndex 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)