G
George Durzi
I created a simple user control which contains a hyperlink to link the user
to a topic in a compiled help file. I named all my help topics to have the
same name as the aspx they are for.
So in the user control help.ascx's html, I have this:
<a href='<%# GenerateHelpLink()%>' class="mischrefcontent2" id="hrfHelp"
runat="server" target="_blank">Help</a>
In the codebehind help.ascx.cs, I have this:
#region GenerateHelpLink
protected void GenerateHelpLink()
{
StringBuilder sb = new StringBuilder();
sb.Append("ms-its:");
sb.Append(ConfigurationSettings.AppSettings["ApplicationURL"].ToString());
sb.Append(ConfigurationSettings.AppSettings["HelpFile"].ToString());
string[] arScript =
Request.ServerVariables["SCRIPT_NAME"].ToString().Split("/".ToCharArray());
string sScript = arScript[arScript.GetUpperBound(0)].ToString();
sb.Append(sScript.Substring(0, sScript.LastIndexOf(".")));
sb.Append(".htm");
// you can ignore these details - this function simply returns a help
URL
return sb.ToString();
}
#endregion
So if I'm at cs_completed.aspx, the above function will return:
ms-its:http://gdurzi/framework/help/MyFelpFile.chm::/cs_completed.htm
In cs_completed.aspx, I do this:
<%@ Register TagPrefix="framework" TagName="help" Src="ascx\help.ascx" %>
and
<framework:help id="_help" runat="server"></framework:help>
The text Help (what's inside the <a></a>) is displayed, but the hyperlink
doesn't work. Upon debugging, I realized the function GenerateHelpLink is
never being called ...
I want to accomplish this without having to write code into every page to
call this function. I just wanted to plop the user control in there and let
it do it's work.. Any idea?
to a topic in a compiled help file. I named all my help topics to have the
same name as the aspx they are for.
So in the user control help.ascx's html, I have this:
<a href='<%# GenerateHelpLink()%>' class="mischrefcontent2" id="hrfHelp"
runat="server" target="_blank">Help</a>
In the codebehind help.ascx.cs, I have this:
#region GenerateHelpLink
protected void GenerateHelpLink()
{
StringBuilder sb = new StringBuilder();
sb.Append("ms-its:");
sb.Append(ConfigurationSettings.AppSettings["ApplicationURL"].ToString());
sb.Append(ConfigurationSettings.AppSettings["HelpFile"].ToString());
string[] arScript =
Request.ServerVariables["SCRIPT_NAME"].ToString().Split("/".ToCharArray());
string sScript = arScript[arScript.GetUpperBound(0)].ToString();
sb.Append(sScript.Substring(0, sScript.LastIndexOf(".")));
sb.Append(".htm");
// you can ignore these details - this function simply returns a help
URL
return sb.ToString();
}
#endregion
So if I'm at cs_completed.aspx, the above function will return:
ms-its:http://gdurzi/framework/help/MyFelpFile.chm::/cs_completed.htm
In cs_completed.aspx, I do this:
<%@ Register TagPrefix="framework" TagName="help" Src="ascx\help.ascx" %>
and
<framework:help id="_help" runat="server"></framework:help>
The text Help (what's inside the <a></a>) is displayed, but the hyperlink
doesn't work. Upon debugging, I realized the function GenerateHelpLink is
never being called ...
I want to accomplish this without having to write code into every page to
call this function. I just wanted to plop the user control in there and let
it do it's work.. Any idea?