ASP.NET中的treeview中如何获取该子节点的所有父节点
展开全部
protected string getParent(TreeNode currTreeNode)
{
string rv = "";
if (currTreeNode.Parent != null)
{
rv = currTreeNode.Parent.Text;
rv += getParent(currTreeNode.Parent);
}
return rv;
}
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
Response.Write(getParent(TreeView1.SelectedNode));
}
{
string rv = "";
if (currTreeNode.Parent != null)
{
rv = currTreeNode.Parent.Text;
rv += getParent(currTreeNode.Parent);
}
return rv;
}
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
Response.Write(getParent(TreeView1.SelectedNode));
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询