Improve the performance of your databases.

Hiding the Root Node from SiteMapPath

CONTACT US TODAY

ASP.NET developers often set SiteMapDataSource’s ShowStartingNode property to false to hide the root node from TreeView and Menu controls. Unfortunately, that doesn’t hide the root node from SiteMapPath controls, because SiteMapPaths bypass SiteMapDataSources and go directly to the site map provider. I’m working on a project right now that requires me to hide the root node from SiteMapPath controls. Here’s how I accomplished it.

Place the following code in Global.asax:

void Application_Start(object sender, EventArgs e)
{
//
// Register a handler for SiteMap.SiteMapResolve events to hide the
// root node from SiteMapPath controls.
//
SiteMap.SiteMapResolve += new SiteMapResolveEventHandler(HideRootNode);
}

static SiteMapNode HideRootNode(Object sender, SiteMapResolveEventArgs e)
{
//
// Hide the root node from SiteMapPath controls by cloning the site
// map from the current node up to the node below the root node and
// setting that node’s ParentNode property to null.
//
SiteMapNode node = SiteMap.CurrentNode.Clone();
SiteMapNode current = node;
SiteMapNode root = SiteMap.RootNode;

    if (current != root) // Just in case the current node *is* the root node!
{
while (node.ParentNode != root)
{
node.ParentNode = node.ParentNode.Clone();
node = node.ParentNode;
}
node.ParentNode = null;
}
return current;
}

This code registers a handler for SiteMap.SiteMapResolve events, which fire each time a SiteMapPath requests the current node (SiteMap.CurrentNode). The handler creates a copy of the site map nodes from the current node up to the node directly underneath the root, and then hides the root node by making the node at the top of the chain the new root node.

On a slightly different subject, I’ve thoroughly enjoyed the World Cup matches, despite the U.S.’s dismal performance. I absolutely LOVE watching soccer–er, football–in Europe and wish I could see more of it. But have you noticed that every time a soccer player gets touched or tripped, he falls to the ground grimacing and writhing in pain? Most of these antics, I’m convinced, are for the benefit of the refs. Still, I wish soccer players would act more like men and less like wimps. The sport would be better for it!

Carefully Tuned Databases

Ensuring a database system has been properly designed, implemented, and tuned requires expertise and ongoing management. Atmosera provides managed Database (DB) services designed to help you get the most out of their systems. Our DB experts are available 24x7x365 to perform any task from basic day-to-day maintenance to complex architecture design.

Get reliable administration.

Drive rapid innovation.

Educate support teams.

We maintain and proactively troubleshoot your databases 24x7x365.

Together we partner to deploy the latest database and storage technology.

We actively help your team better leverage your database tools.

“Atmosera has been more than a infrastructure as a service for Navos. Their DBA team have become trusted partners supplementing our internal staff with deep specialized skills. Their experts have helped us drive additional improvements with our other technology partners. Atmosera brings talent to our team that we would not otherwise have access to and they care about our success.”

– Jim Rudnick, Vice President & Chief Information Officer

Databases Administration (DBA)

  • Day-to-day database administration tasks.
  • Professionals available 24x7x365.
  • Proactive maintenance and troubleshooting of your databases.
  • Rigorous processes to safeguard the security of your databases.
  • Rigorous processes to safeguard the security of your databases.

Database Architecture and Engineering (DBAE)

  • Rapid innovation & deployment of the latest database & storage technologies.
  • Peace of mind which comes from highly trained professionals
  • Thoroughly vetted technology before it ever gets deployed into production environments.
  • Recommendation and migration to the technology which best aligns with your business needs.

Education

  • Assist and teach the application and software development teams how to leverage the tools included with their databases
  • Application and code tuning capabilities.
  • Self-service on performance reporting when making code and tuning changes.

We deliver solutions that accelerate the value of Azure.

Ready to experience the full power of Microsoft Azure?

Start Today

Blog Home

Stay Connected

Upcoming Events

All Events