S
senfo
This is probably a really stupid question, but what exactly is the <%@
Page %> directive? I thought I knew the answer to this, but now I'm not
so sure that I do.
Essentially, what I'd hope to accomplish, is to be able to add new
attributes to the Page element to provide custom functionality. For
example, one of the ASP.NET 2.0 apps that I'm working on has a help
button on most pages. The help button, which is part of the MasterPage,
should automatically provide a link to a help page, which is relevant to
the page the user is on. If it's possible, I'd like to be able to set
the location of the help file in an attribute in the markup like the
following:
<%@ Page language="c#" MasterPage="MasterPage.Master" Inherits="Foo"
CodeFile="Foo.aspx.cs" HelpFile="Help/Foo.html" %>
I thought it only be a matter of creating a new class that inherited
from the Page class, and then adding a HelpFile property. Naturally,
I'd have to update the code behind for my web forms to inherit from my
CustomPage class, rather than System.Web.UI.Page. Unfortunately, this
did not work. Doing so resulted in a compiler error, indicating that
the HelpFile attribute was not valid for the Page element.
Is there any way I can add new attributes to the Page element?
Thank you in advance,
Page %> directive? I thought I knew the answer to this, but now I'm not
so sure that I do.
Essentially, what I'd hope to accomplish, is to be able to add new
attributes to the Page element to provide custom functionality. For
example, one of the ASP.NET 2.0 apps that I'm working on has a help
button on most pages. The help button, which is part of the MasterPage,
should automatically provide a link to a help page, which is relevant to
the page the user is on. If it's possible, I'd like to be able to set
the location of the help file in an attribute in the markup like the
following:
<%@ Page language="c#" MasterPage="MasterPage.Master" Inherits="Foo"
CodeFile="Foo.aspx.cs" HelpFile="Help/Foo.html" %>
I thought it only be a matter of creating a new class that inherited
from the Page class, and then adding a HelpFile property. Naturally,
I'd have to update the code behind for my web forms to inherit from my
CustomPage class, rather than System.Web.UI.Page. Unfortunately, this
did not work. Doing so resulted in a compiler error, indicating that
the HelpFile attribute was not valid for the Page element.
Is there any way I can add new attributes to the Page element?
Thank you in advance,