views:

1036

answers:

2

Hi,

I'm using a ASP.NET menu control. I'd like the menu to look like this, where link 1 through 10 are in one sitemap file and link 11 through 20 in another.

root
--link 1
(...)
--link 10
--link 11
(...)
--link 20

However, sitemap file MUST have a root which I cannot seem to suppress.

Any thoughts?

-Edoode

+1  A: 

Is there any reason that you can't add a dummy root node and then subclass the ASP.NET menu control to ignore your dummy "root" node?

You should be able to tell your SiteMapProvider to use different site maps for the menu.

The other question I have is what's the purpose of having multiple sitemap files? I'm sure you have a valid reason for this, but knowing what's going on would make it easier to understand and come up with a better solution.

That being said, I would come up with a homegrown menu system. You could use jQuery and the superfish plugin on the front end and use C# to read your site map files on the back end to build the menuing structure.

Jeremiah Peschka
The sitemap files are each reused in different sections of the site, this menu is like a 'sitemap' which contains all the links.
edosoft
+2  A: 

You can suppress the root node by doing the following:

SiteMapDataSource ds = new SiteMapDataSource();
ds.SiteMapProvider = "providername";
ds.ShowStartingNode = false;
TreeView1.DataSource = ds;
TreeView1.DataBind();

I use this method to hide the root node for tree views.

Tim