日期:2014-05-16  浏览次数:20685 次

Ext.Net.dlL Treepanel 权限绑定
我想做一个权限用ext框架 但是不知道Treepanel 怎么绑定的(带复选框),哪位做过这个 帮忙看看 非常感谢

------解决方案--------------------
1.页面代码
<ext:TreePanel 
ID="TreePanel1"
runat="server" 
Height="300" 
Width="250"
UseArrows="true"
AutoScroll="true"
Animate="true"
EnableDD="true"
ContainerScroll="true">
</ext:TreePanel>
2.后台代码
 protected void Page_Load(object sender, EventArgs e)
{
SiteMapNode siteNode = SiteMap.RootNode;
TreeNode root = this.CreateNode(siteNode);
root.Draggable = false;
root.Expanded = true;
TreePanel1.Root.Add(root);
}

//static node creation with children
private Ext.Net.TreeNode CreateNode(SiteMapNode siteMapNode)
{
TreeNode treeNode = new TreeNode();

treeNode.NodeID = siteMapNode.Key;
treeNode.Text = siteMapNode.Title;
treeNode.Qtip = siteMapNode.Description;

SiteMapNodeCollection children = siteMapNode.ChildNodes;

if (children != null && children.Count > 0)
{
foreach (SiteMapNode mapNode in siteMapNode.ChildNodes)
{
treeNode.Nodes.Add(this.CreateNode(mapNode));
}
}

return treeNode;
}