473,396 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

Similar topics

0
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...
1
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). ...
4
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: ...
1
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
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? ...
10
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...
2
by: Ranginald | last post by:
Hi, I have two pages. Default.aspx ....Codefile="default.aspx.cs" Inherits="Web" %> and Sculpture.aspx
3
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...

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.