By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,199 Members | 1,551 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,199 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Jun 9 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
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

Jun 12 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.