Question

So, here's what I'm working on. I have an ASP.NET web app, in which the sitemap is displayed on the site.master file through the web.sitemap. Here's the site.master:

<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
<asp:TreeView
 ID="TreeView1"
 runat="server"
 ataSourceID="SiteMapDataSource1"
 ExpandDepth="1">
    </asp:TreeView>

And here's the web.sitemap:

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
    <siteMapNode url="~/Default.aspx" title="Home"  description="Home">        
      <siteMapNode url="" title="Projects"  description="">        
      </siteMapNode>
      <siteMapNode url="" title="Configurations"  description="Configurations">
        <siteMapNode url="" title="Experiments" description="Experiments">
        </siteMapNode>
        <siteMapNode url="" title="Cell Line" description =""></siteMapNode>
        <siteMapNode url ="" title ="Drugs">
        </siteMapNode>
        <siteMapNode url ="" title="Manage Configurations" />
          <siteMapNode url="~/ExperimentConfigurationView.aspx" title ="Configure Experiements"/>
          <siteMapNode url="~/DrugConfigurationView.aspx" title="Configure Drugs"/>
        </siteMapNode>
      </siteMapNode>
      <siteMapNode url="" title="Drug Recipes" description="">
      </siteMapNode>
    </siteMapNode>
</siteMap>

Now, here's where I'm running into a problem. What I'd like to do is combine this site map with a dynamically created SiteMapProvider, and populate the sub-trees of this map. For example, the Projects, Experiments, Cell Line and Drug Recipe nodes would each have a sub-tree, populated from a datebase. Anyone have input, or a suggestion as to where to start looking?

In summary - I'd like to point the leaf siteMapNodes to a SiteMapProvider.

Was it helpful?

Solution

Solution:

I added a file DrugListProvider.cs in the root directory. That holds the code for dynamically generating the sub-tree.

I placed the following node in the Web.sitemap, where I wanted the sub-tree to appear:

<siteMapNode provider="DrugListProvider"/>

Finally, I include this in the web.config file:

<siteMap>
  <providers>
    <add name="DrugListProvider" type="PrivoWeb.DrugListProvider"/>
  </providers>
</siteMap>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top