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='<%# GenerateHelpLin k()%>' class="mischref content2" id="hrfHelp"
runat="server" target="_blank" >Help</a>
In the codebehind help.ascx.cs, I have this:
#region GenerateHelpLin k
protected void GenerateHelpLin k()
{
StringBuilder sb = new StringBuilder() ;
sb.Append("ms-its:");
sb.Append(Confi gurationSetting s.AppSettings["ApplicationURL "].ToString());
sb.Append(Confi gurationSetting s.AppSettings["HelpFile"].ToString());
string[] arScript =
Request.ServerV ariables["SCRIPT_NAM E"].ToString().Spl it("/".ToCharArray() );
string sScript = arScript[arScript.GetUpp erBound(0)].ToString();
sb.Append(sScri pt.Substring(0, sScript.LastInd exOf(".")));
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.as px, the above function will return:
ms-its:http://gdurzi/framework/help/MyFelpF..._completed.htm
In cs_completed.as px, I do this:
<%@ Register TagPrefix="fram ework" TagName="help" Src="ascx\help. ascx" %>
and
<framework:he lp 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 GenerateHelpLin k 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='<%# GenerateHelpLin k()%>' class="mischref content2" id="hrfHelp"
runat="server" target="_blank" >Help</a>
In the codebehind help.ascx.cs, I have this:
#region GenerateHelpLin k
protected void GenerateHelpLin k()
{
StringBuilder sb = new StringBuilder() ;
sb.Append("ms-its:");
sb.Append(Confi gurationSetting s.AppSettings["ApplicationURL "].ToString());
sb.Append(Confi gurationSetting s.AppSettings["HelpFile"].ToString());
string[] arScript =
Request.ServerV ariables["SCRIPT_NAM E"].ToString().Spl it("/".ToCharArray() );
string sScript = arScript[arScript.GetUpp erBound(0)].ToString();
sb.Append(sScri pt.Substring(0, sScript.LastInd exOf(".")));
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.as px, the above function will return:
ms-its:http://gdurzi/framework/help/MyFelpF..._completed.htm
In cs_completed.as px, I do this:
<%@ Register TagPrefix="fram ework" TagName="help" Src="ascx\help. ascx" %>
and
<framework:he lp 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 GenerateHelpLin k 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?
Comment