How do I use Import or Inherits on a Single Page .aspx Page

  • Thread starter Thread starter Christian Blackburn
  • Start date Start date
C

Christian Blackburn

Hi Gang,

I have trouble getting my single page Aspx pages to allow the imports
and or inherits command. Can someone reply with an example.

Thanks,
Christian Blackburn
 
Import and Inherit are very different animals.

Imports is like a big With statement for your current file. It brings a namespace
into scope so that you can use it without having to fully qualify the name
you are using. You specify the imports at the very top of your code.

Inherits means that you want your new class to be based on the class you
are inheriting from. Inherits are placed on the class not on the file, thus
it should be the first line after your class declaration. You can only inherit
from one class because a thing can only be one thing ("is a" relationship).
It may contain many things ("has a" relationship) which is where interfaces
come in.

Since you are working with web applications, your web forms already inherit
from System.Web.UI.Page. It can not directly inherit from something else
as well (although you can subclass that and extend it with your own functionality
if necessary).

Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx
 
Back
Top