private static string GetResultJosnStr(TreeNodeResult node) { try { StringBuilder reslut = new StringBuilder(); if (node != null) { reslut.AppendFormat("\"id\":\"{0}\"", node.Tid);// "text":"Java") reslut.AppendFormat(",\"text\":\"{0}\"", node.Ttext); if (node.TChecked) { reslut.Append(",\"checked\":\"true\""); } if (node.TState) { reslut.AppendFormat(",\"state\":\"{0}\"", "closed"); } if (!string.IsNullOrEmpty(node.Url)) { reslut.Append(",\"attributes\":{\"url\":\"" + node.Url + "\",\"fullname\":\"" + node.FullName + "\"}"); } if (node.Tchildren.Length > 0) { reslut.AppendFormat(",\"children\":{0}", GetResultJosnS(node.Tchildren)); } } return("{" + reslut.ToString().TrimStart(',') + "}"); } catch (Exception) { throw; } }
/// <summary> /// 添加节点 /// </summary> /// <param name="pNode"></param> public void RemovechildNode(TreeNodeResult pNode) { _node.Remove(pNode); }
/// <summary> /// 添加节点 /// </summary> /// <param name="pNode"></param> public void AddchildNode(TreeNodeResult pNode) { _node.Add(pNode); }