0
我在创建ASP.NET webapp中的树视图时出现问题。我正在使用XenAPI,并直接将项目加载到树视图中而不使用数据库。TreeView单元格未对齐
正如您从下图所见,列表中的项目与一个父节点“xenserver-kmmglbto”正确无误。问题是我无法弄清楚为什么前面的单元格不对齐?我只是不明白他们为什么不正确排队,看起来很乱。
protected void RefreshTreeView(Session XenSession)
{
int hostCount = 0;
List<XenRef<Host>> hostRefs = Host.get_all(CurrentSession);
foreach (XenRef<Host> hostRef in hostRefs)
{
// obtain the full host record from the server
Host host = Host.get_record(CurrentSession, hostRef);
TreeView1.Nodes.Add(new TreeNode(host.name_label));
// Get the list of VMs
List<XenRef<VM>> vmRefs = VM.get_all(XenSession);
foreach (XenRef<VM> vmRef in vmRefs)
{
// get the entire record for each VM.
VM vm = VM.get_record(XenSession, vmRef);
if (!vm.is_a_snapshot & !vm.is_snapshot_from_vmpp & !vm.is_control_domain & !vm.is_a_template)
{
TreeView1.Nodes[hostCount].ChildNodes.Add(new TreeNode(vm.name_label));
}
}
hostCount++;
}
}