This is a migrated thread and some comments may be shown as answers.

[Solved] SiteMap with custom attributes

0 Answers 120 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 18 May 2008, 10:28 AM
Hi, I would like to connect my Web.sitemap to the treeview component and use custom attributes in my sitemap for the DataTextField and DataValueField, is this possible?

Using default attributes from Web.sitemap works fine, ex:
RadTreeView1.DataSource = SiteMapDataSource1;
RadTreeView1.DataTextField = "title";
RadTreeView1.DataValueField = "url";

How do I set the DataTextField to a custom attribute named "pageTitle"? I can't figure out how to get access to it.

Edit: I found the solution from a older version, just had to rewrite it a little. Here's the solution:
protected void RadTreeView1_NodeDataBound(object sender, RadTreeNodeEventArgs e)
    {
        SiteMapNode siteMapNode = (SiteMapNode)e.Node.DataItem;
        e.Node.Text = siteMapNode["pageTitle"];
    }

No answers yet. Maybe you can help?

Tags
TreeView
Asked by
Jay
Top achievements
Rank 1
Share this question
or