获得CheckBox,Checked的Nodes的Text值拼串 - FineUITreeGetCheckedNodesText

2017-02-21 22:02:58  访问(1493) 赞(0) 踩(0)


        /// <summary>
        /// 获得CheckBox,Checked的Nodes的Text值拼串 - FineUITreeGetCheckedNodesText
        /// </summary>
        /// <param name="extAspNetTree"></param>
        /// <returns></returns>
        public static string FineUITreeGetCheckedNodesText(FineUI.Tree extAspNetTree)
        {
            return FineUITreeGetCheckedNodesText(extAspNetTree, false);
        }


        /// <summary>
        /// 获得CheckBox,Checked的Nodes的Text值拼串 - FineUITreeGetCheckedNodesText
        /// </summary>
        /// <param name="extAspNetTree"></param>
        /// <param name="removeNumber"></param>
        /// <returns></returns>
        public static string FineUITreeGetCheckedNodesText
            (
                FineUI.Tree extAspNetTree, 
                bool removeNumber
            )
        {
            FineUI.TreeNode[] tn = extAspNetTree.GetCheckedNodes();

            StringBuilder theResult = new StringBuilder();

            if (removeNumber)
            {
                string sItem = "";
                int idxLeft = -1;
                int idxRight = -1;

                foreach (FineUI.TreeNode n in tn)
                {
                    sItem = n.Text;
                    idxLeft = sItem.LastIndexOf('(');
                    idxRight = sItem.LastIndexOf(')');

                    if (idxLeft != -1)
                    {
                        if (idxLeft < idxRight)
                            sItem = sItem.Substring(0, idxLeft);
                    }

                    theResult.Append(sItem + ";");
                }
            }
            else
            {
                foreach (FineUI.TreeNode n in tn)
                {
                    //if (theResult != "")
                    //    theResult += ";";

                    //theResult += n.Text;

                    theResult.Append(n.Text + ";");
                }
            }

            return theResult.ToString();
        }


标签:获得CheckBox,Checked的Nodes的Text值拼串 - FineUITreeGetCheckedNodesText 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)