This is a simple and quick help system which pops up page-specific help page on the base of URL. One can change the HTML text of the help anytime for any page by changing the XML file kept at the website folder.
Recently I was asked by a client to develop a simple and quick help system which should be page specific and using which he can change the HTML text of the help anytime for any page by changing any static file kept at the website folder.
Using the Code
The default page is the dummy place from where hyperlink can be clicked to pop up the help for default page. This can be placed at some common place like master page which will bring the page id from XML on the basis of the URL on the address bar and then redirect to DynamicHelp.aspx - the page which is the common page for rendering help for any page.
GetPageQueryStringsFromXML() + "','DynamicHelp','width=500,height=300,
This is the page XML I am using for mapping
title, please note
html being in
CDATA, I can put any
<Page id="2" url="/Default.aspx" helptitle="Default help title">
Then in the Help page, I am fetching the helptext on and title text on the basis of page id and rendering it on HTML page as follows:
XPathDocument doc = null;
XPathNavigator nav = null;
XPathExpression expr = null;
XPathNodeIterator iterator = null;
StringBuilder sbHtml = new StringBuilder();
ttlHelp.Text = (pageTitle != "0") ? pageTitle : "";
doc = new XPathDocument(Server.MapPath("/Components/PageHelp.xml"));
nav = doc.CreateNavigator();
expr = nav.Compile("/Pages/Page[@id=" + pageID + "]/PageHelpText");
iterator = nav.Select(expr);
if (iterator.Count > 0)
if (iterator.Current.InnerXml != null)
sbHtml.Append("Help:" + pageTitle + "<br/><br/>");
divHelpParent.InnerHtml = sbHtml.ToString();
Response.Write("Sorry! No help available for this page!");
sbHtml = null;
pageID = null;
pageTitle = null;
doc = null;
nav = null;
expr = null;
iterator = null;
Points of Interest
I liked the efficient way of bringing text from XML using
XPathDocument and the dynamic nature of this tool to add any kind of help text you want into the XML itself.
This is the first version, I am sure you guys can give many tips for improvement, waiting for those. Thanks!