Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何向asp.net Treeview控件的TreeNode添加Attibute_Asp.net - Fatal编程技术网

如何向asp.net Treeview控件的TreeNode添加Attibute

如何向asp.net Treeview控件的TreeNode添加Attibute,asp.net,Asp.net,我有一个树状视图,在其中的特定节点上,我希望添加rel=“nofollow属性” 但是在TreeNode对象中,我没有找到Attributes.Add方法 请告诉我如何在我的特定树节点上添加rel=“nofollow”您可以将树节点文本包装在锚()元素中,并将rel=“nofollow”值应用于锚,如下所示: C#: protectedvoid TreeView1_TreeNodeDataBound(对象发送方,TreeNodeEventArgs e) { e、 Node.Text=”“+e.N

我有一个树状视图,在其中的特定节点上,我希望添加rel=“nofollow属性” 但是在TreeNode对象中,我没有找到Attributes.Add方法


请告诉我如何在我的特定树节点上添加rel=“nofollow”

您可以将树节点文本包装在锚(
)元素中,并将
rel=“nofollow”
值应用于锚,如下所示:

C#:

protectedvoid TreeView1_TreeNodeDataBound(对象发送方,TreeNodeEventArgs e)
{
e、 Node.Text=”“+e.Node.Text+”;
}
VB.NET:

Protected Sub TreeView1_TreeNodeDataBound(sender As Object, e As TreeNodeEventArgs)
    e.Node.Text = "<a rel='nofollow'>" & e.Node.Text & "</a>"
End Sub
受保护的子树eview1\u TreeNodeDataBound(发送方作为对象,e作为TreeNodeEventArgs)
e、 Node.Text=“&e.Node.Text&”
端接头

它不起作用。它导致了“id=“tvCategoriest9”>“id=“tvCategoriest9”rel='nofollow'>其他(12)
Protected Sub TreeView1_TreeNodeDataBound(sender As Object, e As TreeNodeEventArgs)
    e.Node.Text = "<a rel='nofollow'>" & e.Node.Text & "</a>"
End Sub