User-1513591455 posted
I have an application that has its own help system. Clicking a "help" link on the page or pressing the F1 key provdes a newly opened help window with the correct page help. It does this by referencing the Page.ID value passed in a querystring.
You could go furthe and add a reference to a control on the page too
There is some javascript required to intercept the existing help event and redirect to your own
<script
type="text/javascript"
language="Javascript">
//Redirect help requests to our own function
document.onhlep = MyHelp;
window.onhelp = MyHelp;
// intercept the web browser help request (F1 pressed) and redirect to our own help
function MyHelp() {
// I already have a help link in the page with an image in. Code behind sets the Page.ID to give the relevant querystring. Simulate a user clicking the hyperlink
$get(
'<%= hlnkHelp.ClientID %>').click();
// return false to cancel browser opening Windows F1 Help when we have finished
return
false;
}
</script>
Elsewhere in the page...
<
asp:HyperLink
ID="hlnkHelp"
runat="server"
Target="Help"
NavigateUrl="~/Help.aspx"
ToolTip="View Help for this Page"
ImageUrl="~/Images/Help.png"></asp:HyperLink>
Elsewhere in the code behind page load
if (!IsPostBack)
// set the help querystring - although this value could also be set in the ASPX page too
hlnkHelp.NavigateUrl = "~/Help.aspx?WebPageId=" + Page.ID;