473,394 Members | 1,740 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,394 software developers and data experts.

common custom classes

I have created a few pages in asp.net with in line code and have decided
to convert them to use code behind pages. I have some classes that are
common to more than one page. How do I add a namespace to my code behind,
so I can have one file with my code behind that includes a reference to a
file with my common classes in it?

Thanks

Tony
Nov 19 '05 #1
2 1028
If the file containing the common classes is in the same project but has
a different namespace you can simply put a using (C#) or Imports(VB.Net)
statement at the top of the code behind class:

using The.Other.Namespace; //This is for C#

or

Imports The.Other.Namespace 'This is for VB.Net

If the file containing the other classes is in another project/assembly,
you'll also need to set a reference to the DLL that contains the class.
Hope that helps.

Have A Better One!

John M Deal, MCP
Necessity Software

Tony wrote:
I have created a few pages in asp.net with in line code and have decided
to convert them to use code behind pages. I have some classes that are
common to more than one page. How do I add a namespace to my code behind,
so I can have one file with my code behind that includes a reference to a
file with my common classes in it?

Thanks

Tony

Nov 19 '05 #2
On Sun, 05 Dec 2004 09:03:04 -0800, John M Deal wrote:
If the file containing the common classes is in the same project but has a
different namespace you can simply put a using (C#) or Imports(VB.Net)
statement at the top of the code behind class:

using The.Other.Namespace; //This is for C#

or

Imports The.Other.Namespace 'This is for VB.Net

If the file containing the other classes is in another project/assembly,
you'll also need to set a reference to the DLL that contains the class.
Hope that helps.


Thanks for the reply, I am programming in VB.net using a text editor, do I
absolutely need to compile my common classes into a dll or is there a way
of adding a reference/path to a source file? if so what is the syntax?

Tony

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: J Smithers | last post by:
I have several ASPX pages (with code-behind logic) that I reuse amongst many Web sites on the same production server. Currently each Web site has its own copy of these aspx pages. I was thinking...
5
by: SAI | last post by:
In old asp, we like to write some "inc" file for including some common shared functions between pages. How to do it in asp.net? should I use .cs file to do it? Besides, should I compile these .cs...
7
by: Adam | last post by:
Im trying to add an httphandler for all *.sgf file extensions. I have developed the handler, 1. installed it into the gac 2. added it to the machine.config: <httpHandlers> <add verb="*"...
8
by: a | last post by:
I'm trying to save data from a custom object into the profile object, but it is not structured the way that I want. I'm trying to get the custom object to serialize as xml to a Profile object...
0
by: a | last post by:
I need to create an instance of a custom object 'School.Teacher' and use it in a Profile object. I'm developing a bad case of "Pretzel Logic" thinking about this. Filling the custom object ...
2
by: prabhupr | last post by:
Hi Folks I was reading this article (http://www.dotnetbips.com/articles/displayarticle.aspx?id=32) on "Custom Attribute", written by Bipin. The only thing I did not understand in this article...
2
by: Smithers | last post by:
I have a Windows Forms application that implements a plug-in architecture whereby required assemblies are identified and loaded dynamically. Here are the relevant classes: A = application =...
3
by: Curious | last post by:
I have too similar methods in two classes: -----------------------DistributionFoo--------------------- class DistributionFoo : FooBase { private...
5
by: King | last post by:
I am new to python and getting into classes. Here I am trying to create subtype of built in types with some additional attributes and function. 'Attributes' is the main class and holds all the...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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...

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.