asp:TreeView how do I get the links to my pages?


Hi all!

Iam trying to do a sitemap. The layout of the sitemap calls for an asp:TreeView because of the, well, tree design our designer wants. Here is my code

// Front end

<EPiServer:PageDataSource runat="server" ID="websiteMapTreePages" IncludeRootPage="false" EnableVisibleInMenu="false" />
<asp:TreeView ID="websiteMapTree" Runat="server" DataSourceID="websiteMapTreePages">
             <asp:TreeNodeBinding TextField="PageName" ValueField="PageLink" />

// Back end

protected void Page_Load(object sender, EventArgs e)
websiteMapTreePages.PageLink = CurrentPage["websiteMapTreeCTRL"] as PageReference ?? PageReference.StartPage;
websiteMapTree.ShowExpandCollapse = false;
websiteMapTree.ShowLines = true;

The Pagetree looks good. The name of all the pages in my EpiServer site is displayed correctly. But I cant get the links to work. Is ValueField="PageLink" wrong? Am I missing something? NavigateUrl="" works however.

Please, how do I get the links to work? I have tried many different attributes for the asp:TreeNodeBinding tag ...


Many thanks

Jul 12, 2012 0:45

Of course if someone have another idea of doing a site map with the same design as the explorer in windows, using episerver controls and CSS, please let me know.

Jul 12, 2012 3:23

NavigateUrlField="LinkUrl" did work. =/ He he.

Ok, but another question: when the site is viewed in swedish I only want the swedish version of pages to display, the same for english. Like a PageTree work. How do I do that?

Jul 12, 2012 3:44

<EPiServer:PageDataSource UseFallbackLanguage="false" did seem to work. =)

Yes. This is pretty advanced stuff for me. If you have any comments on the code. please share. But evething seems to work now. Only CSS left for my beautiful site map.

Jul 12, 2012 3:54
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.