473,795 Members | 3,100 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
1 1936
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.P age. 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1339
by: djus | last post by:
Hello At the begining I'm sorry for my English :( I want my aspx page TestPage.aspx to inherit from MyClass2. MyClass2 inherits from MyMainClass which is subtype of Page: public class MyMainClass : Page public class MyClass2 : MyMainClass
1
1693
by: Horace | last post by:
Hello Does anyone know how to remove (or make more general) both the Imports clause (in a class .vb file) and the Page directive (specifically the Inherits clause in a web page .aspx file). Because we have a test and production region both residing on the same machine, each time I need to promote a change from test to production I have to change both of these references.
4
6112
by: Bruce W. Roeser | last post by:
All, I'm reading a book by Charles Petzold (Programming VS.Net). Pretty good content but am confused about the difference. From the text: ---------------------------------------------------------------------------------------------------------------------------------------------------------- The @ Import Directive Next to @ Page, the directive that ASP.NET programmers use the most is @ Import. The @ Import directive is ASP.NET's...
1
1730
by: Roberto Bindini | last post by:
Hi with visual studio 2005 beta 2 i have created two form: frm1 (Inherits System.Web.UI.Page) frm2 (Inherits frm1) but in the line code : Inherits frm1 vs send error: type frm1 is not defined
2
1359
by: Randall Parker | last post by:
I've noticed that C# can only inherit from a single class. At the same time, the CodeBehind in an aspx.cs file inherits from Page. So what do you all do to reuse code in .aspx.cs classes? Seems to me one has to create classes and make them members of classes in the aspx.cs files. Is that what you all do? (at least those of you who try to get re-use)
10
2162
by: Tony Abate | last post by:
I am working on an ASP.NET app that is going well except for one thing. I build my application and then move the .aspx file to a different directory. I can point the Codebehind property back to the .aspx.vb file in the original directory, but cannot do so with the Inherits property. I know one solution is to place the DLL file in the new directory with my .aspx file, but I would like to avoid this as it would require me to update all the...
2
2146
by: Ranginald | last post by:
Hi, I have two pages. Default.aspx ....Codefile="default.aspx.cs" Inherits="Web" %> and Sculpture.aspx
3
2307
by: Chris | last post by:
Hi, 1) In file test.aspx, i put: <%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %> <%@ import namespace="System.Data"%> <%@ import namespace="System.Data.OleDb"%> .... In file test.aspx.vb, i put:
2
1819
by: Sebho | last post by:
Hi, i have an asp page (page1.aspx) that inherits from a masterpage (MasterPage.master) so i try to define a stylesheet (mystyle.css) page to Page1.aspx and i have to put a <linktag between <headand </head. But my problem is in a page who inherits from a masterpage i have no the tag <head and </headand i can't reference my styleSheet
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10163
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9037
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.