我有一个treepanel,我可以成功地将数据加载到treeopanel。但是 我想将treepanel的rootVisible属性设置为false。当我将rootVisible属性设置为false时,我收到类似Request Failure的错误。相关的截图如下。尽管出现错误,但它仍能正常工作。
如何克服这一点。
相关代码块是;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ConcreteDepartmentDefinition [] l = Department.GetDepartmentList();
foreach (var obj in l)
{
if (obj.DepartmentParentOid == null || obj.DepartmentParentOid == 0)
{
Node root = new Node();
root.NodeID = obj.Oid.ToString();
root.Text = "<b>"+obj.DepartmentCode+"</b> - "+obj.DepartmentName;
root.Icon = Icon.UserHome;
root.Leaf = obj.IsLeaf;
treePanel1.Root.Add(root);
treePanel1.RootVisible = false;
}
else
{
Node newNode = new Node();
newNode.NodeID = obj.Oid.ToString();
newNode.Text = "<b>"+obj.DepartmentCode+"</b> - "+obj.DepartmentName;
newNode.Icon = Icon.UserGreen;
newNode.Leaf = obj.IsLeaf;
treePanel1.GetNodeById(obj.DepartmentParentOid.ToString()).AppendChild(newNode);
}
}
}