<?
xml version="1.0" encoding="utf-8" ?> <
siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" > <
siteMapNode url="" title="Root" description=""> <
siteMapNode url="~/Default.aspx" title="Home" description="" /> <
siteMapNode url="~/ContactUs.aspx" title="Contact Us" description="" /> <
siteMapNode url="~/Help.aspx" title="Help" target ="_blank" /> </
siteMapNode> </
siteMap>
If you run the page you will see the menu like the following:

As, you can see in the above image that I have a asp:Menu control that displays certain links. The menu also have a "help" option which will display the help of the page the user is currently on. The code for this is pretty simple.
protected
void Menu1_MenuItemDataBound(object sender, MenuEventArgs e) {
if(e.Item.Text.Equals("Help"))
{
e.Item.NavigateUrl = BuildHelpLink();
}
}
private string BuildHelpLink()
{
StringBuilder sb = new StringBuilder();
string pageName = GetCurrentPageName();
string url = "Help.aspx?pageName=" + pageName;
sb.Append("javascript:OpenHelpWindow('");
sb.Append(url);
sb.Append("','HelpWindow')");
return sb.ToString();
}
private string GetCurrentPageName()
{
string pageNameWithExtension = Page.Request.AppRelativeCurrentExecutionFilePath;
return System.IO.Path.GetFileNameWithoutExtension(pageNameWithExtension);
}
And now in the Help.aspx page you can look into an xml file and display the help that you needed.
public
partial class Help : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindData();
}
}
private void BindData()
{
string pageName = Request.QueryString["pageName"] as String;
if (!String.IsNullOrEmpty(pageName))
{
lblHelpMessage.Text = CacheManager.GetHelpByPageName(pageName);
}
}
}
The CacheManager class caches the xml file and gets the content that you are looking for:
using
System; using
System.Data; using
System.Configuration; using
System.Web; using
System.Web.Security; using
System.Web.UI; using
System.Web.UI.WebControls; using
System.Web.UI.WebControls.WebParts; using
System.Web.UI.HtmlControls; using
System.Xml;
public
class CacheManager {
private const string MESSAGES_FILE_PATH = "~/HelpMessages.xml";
private const string XML_DOCUMENT = "XmlDocument";
public static string GetHelpByPageName(string pageName)
{
return GetMessageByElementName(pageName);
}
private static string GetMessageByElementName(string elementName)
{
string message = String.Empty;
XmlDocument xmlDoc = null;
if (HttpContext.Current.Cache[XML_DOCUMENT] == null)
{
xmlDoc = new XmlDocument();
xmlDoc.Load(HttpContext.Current.Server.MapPath(MESSAGES_FILE_PATH));
// insert into cache object