EasyUI适用于zTree 、EasyUI tree、EasyUI treegrid

                throw;
            }
        }
        #endregion

 #region 
        System.Text.StringBuilder b_appline = new
System.Text.StringBuilder();
        System.Text.StringBuilder b_children = new
System.Text.StringBuilder();
        /// <summary>
        /// 适用于zTree 、EasyUI tree、EasyUI treegrid
        /// zTree设置id,name,EastyUI 设置 id,text EasyUI treegrid
可自定义
        /// </summary>
        /// <param name=”Source”>数据源</param>
        /// <param name=”_parentidName”>父级名称</param>
        /// <param
name=”_parentidValue”>父级拔尖节点</param>
        /// <param name=”Key”>子节点(唯一值)</param>
        /// <returns></returns>
        public string GetTreeJson(DataTable Source, string
_parentidName, string _parentidValue, string Key)
        {
            try
            {
                b_appline.Append(b_children.ToString());
                b_children.Clear();
                if (Source.Rows.Count > 0)
                {
                    b_children.Append(“[“);
                    DataRow[] row =
Source.Select(string.Format(“{0}='{1}'”, _parentidName,
_parentidValue));
                    if (row.Count() > 0)
                    {
                        for (int i = 0; i < row.Count(); i++)
                        {
                            b_children.Append(“{“);
                            for (int c = 0; c < Source.Columns.Count;
c++)
                            {
                               
b_children.AppendFormat(“\”{0}\”:\”{1}\”,”,
Source.Columns[c].ColumnName, row[i].ItemArray[c]);
                            }
                            b_children.Remove(b_children.Length – 1,
1);
                            if (Source.Select(string.Format(“{0}='{1}'”,
_parentidName, row[i][Key].ToString())).Length > 0)
                            {
                               
b_children.Append(“,\”children\”:”);
                                GetTreeJson(Source,
_parentidName,row[i][Key].ToString(), Key);
                               
b_appline.Append(b_children.ToString());
                                b_children.Clear();
                            }
                            b_appline.Append(b_children.ToString());
                            b_children.Clear();
                            b_children.Append(“},”);
                        }
                        b_children.Remove(b_children.Length – 1, 1);
                    }
                    b_children.Append(“]”);
                    b_appline.Append(b_children.ToString());
                    b_children.Clear();
                }
                return b_appline.ToString();
            }
            catch (Exception)
            {