User Control SiteMap Provider Rendering Error

Posted by Serexx on Stack Overflow See other posts from Stack Overflow or by Serexx
Published on 2010-05-02T21:56:30Z Indexed on 2010/05/02 21:57 UTC
Read the original article Hit count: 513

I have created a Custom Server Control that renders the SiteMap as a pure UL for CSS styling.

At run-time it renders properly but in VS2008 Design View VS shows this error:

Error Rendering Control - menuMainAn unhandled exception has occurred. The provider 'AspNetXmlSiteMapProvider' specified for the defaultProvider does not exist in the providers collection.

I have 'AspNetXmlSiteMapProvider' specified in web.config as per here : link text While I am happy that the code runs properly, the Designer error is bothersome if the underlying issue might cause the code to break in some circumstances so I need to understand what is going on...

The code explicitly references the sitemap in the Render Method with :

int level = 1;
string ul = string.Format("<div class='{0}' id='{1}'>{2}</div>", CssClassName, this.ID.ToString(), EnumerateNodesRecursive(SiteMap.RootNode, level));
output.Write(ul);

and the recursive method called referrences SiteMap.CurrentNode. Otherwise there are no explicit sitemap references in the code.

Does anyone have any ideas why Deisgner is complaining?

© Stack Overflow or respective owner

Related posts about sitemap

Related posts about portalsitemapprovider