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

custom namespaces

Howdy
Relatively new to .NET, I'm trying to create custom a namespace for use in
creating some utility classes, which I seem to have done OK, however, I'm
having a problem trying to use the class with the error the namespace can't
be found.

I've really got no idea what I'm doing, I'm coding in C# and essentially
using notepad, and trying to get my code behind file to use the class in my
custom namespace.

I'm guessing the problem is that I haven't compiled my namespace into a dll,
but I don't have access to the command line compiler on the network PC here
which doesn't help, nor Visual Studio.

I've been told I somehow need to add a reference to my namespace if I was
using Visual Studio, but I don't have it, nor a command line compiler. Is it
possible without these?

Basically, I'm looking for an article that is entitled "how to create and
reference your own namespaces without visual studio".
I've tried putting my code behind and .cs file with my namespace in the bin
directory to no avail.

Any tips greatly appreciated
Cheers
Matt
Nov 19 '05 #1
4 1431
Hi, Matt.

Take a look at :
http://www.asp101.com/articles/john/...vs/default.asp

If you look at the code in WebForm2.aspx.vb as your codebehind,
but use the Page statement in WebForm3.aspx, you'll have
the answer to your question.

In essence, to use code-behind, you can :

1. use the Visual Studio model
2. compile the code-behind to an assembly and reference it in the aspx
3. use the Src and Inherits properties :
<%@ Page Language="vb" AutoEventWireup="false" Src="WebForm2.aspx.vb"
Inherits="WebForm2"%>

This last one is your answer. Adapt it to your needs.

You will be able to call any class, property or method by using Src,
just like if you were using an actual assembly.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Matt Jensen" <re***************@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Howdy
Relatively new to .NET, I'm trying to create custom a namespace for use in creating some
utility classes, which I seem to have done OK, however, I'm having a problem trying to
use the class with the error the namespace can't be found.

I've really got no idea what I'm doing, I'm coding in C# and essentially using notepad,
and trying to get my code behind file to use the class in my custom namespace.

I'm guessing the problem is that I haven't compiled my namespace into a dll, but I don't
have access to the command line compiler on the network PC here which doesn't help, nor
Visual Studio.

I've been told I somehow need to add a reference to my namespace if I was using Visual
Studio, but I don't have it, nor a command line compiler. Is it possible without these?

Basically, I'm looking for an article that is entitled "how to create and reference your
own namespaces without visual studio".
I've tried putting my code behind and .cs file with my namespace in the bin directory to
no avail.

Any tips greatly appreciated
Cheers
Matt

Nov 19 '05 #2
Thanks Juan, but I'm already doing that... - what I need to do is access the
classes in my own custom *namespace* which is essentially in it's own
*standalone* cs (utility) file, and for which I think I must need to compile
it so that the code behind can actually see/find reference to the custom
namespace...
Matt

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:O%****************@TK2MSFTNGP14.phx.gbl...
Hi, Matt.

Take a look at :
http://www.asp101.com/articles/john/...vs/default.asp

If you look at the code in WebForm2.aspx.vb as your codebehind,
but use the Page statement in WebForm3.aspx, you'll have
the answer to your question.

In essence, to use code-behind, you can :

1. use the Visual Studio model
2. compile the code-behind to an assembly and reference it in the aspx
3. use the Src and Inherits properties :
<%@ Page Language="vb" AutoEventWireup="false" Src="WebForm2.aspx.vb"
Inherits="WebForm2"%>

This last one is your answer. Adapt it to your needs.

You will be able to call any class, property or method by using Src,
just like if you were using an actual assembly.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Matt Jensen" <re***************@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Howdy
Relatively new to .NET, I'm trying to create custom a namespace for use
in creating some utility classes, which I seem to have done OK, however,
I'm having a problem trying to use the class with the error the namespace
can't be found.

I've really got no idea what I'm doing, I'm coding in C# and essentially
using notepad, and trying to get my code behind file to use the class in
my custom namespace.

I'm guessing the problem is that I haven't compiled my namespace into a
dll, but I don't have access to the command line compiler on the network
PC here which doesn't help, nor Visual Studio.

I've been told I somehow need to add a reference to my namespace if I was
using Visual Studio, but I don't have it, nor a command line compiler. Is
it possible without these?

Basically, I'm looking for an article that is entitled "how to create and
reference your own namespaces without visual studio".
I've tried putting my code behind and .cs file with my namespace in the
bin directory to no avail.

Any tips greatly appreciated
Cheers
Matt


Nov 19 '05 #3
re:
I'm having a problem trying to use the class with the error "the namespace can't be
found."
If I understand you right, in that you're already using src,
then method #2 ( assembly compilation ) is what you need to implement.

There's sample compilation commands in that article.

re:
I'm guessing the problem is that I haven't compiled my namespace into a dll, but I
don't have access to the command line compiler


Well, compiled code doesn't work by osmosis.

Either you use the "src=" method, or you compile to an assembly
from the command-line, if you aren't using Visual Studio.

There's no getting around that.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Matt Jensen" <re***************@microsoft.com> wrote in message
news:ee**************@TK2MSFTNGP14.phx.gbl... Thanks Juan, but I'm already doing that... - what I need to do is access the classes in
my own custom *namespace* which is essentially in it's own *standalone* cs (utility)
file, and for which I think I must need to compile it so that the code behind can
actually see/find reference to the custom namespace...
Matt

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:O%****************@TK2MSFTNGP14.phx.gbl...
Hi, Matt.

Take a look at :
http://www.asp101.com/articles/john/...vs/default.asp

If you look at the code in WebForm2.aspx.vb as your codebehind,
but use the Page statement in WebForm3.aspx, you'll have
the answer to your question.

In essence, to use code-behind, you can :

1. use the Visual Studio model
2. compile the code-behind to an assembly and reference it in the aspx
3. use the Src and Inherits properties :
<%@ Page Language="vb" AutoEventWireup="false" Src="WebForm2.aspx.vb"
Inherits="WebForm2"%>

This last one is your answer. Adapt it to your needs.

You will be able to call any class, property or method by using Src,
just like if you were using an actual assembly.
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Matt Jensen" <re***************@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Howdy
Relatively new to .NET, I'm trying to create custom a namespace for use in creating
some utility classes, which I seem to have done OK, however, I'm having a problem
trying to use the class with the error the namespace can't be found.

I've really got no idea what I'm doing, I'm coding in C# and essentially using
notepad, and trying to get my code behind file to use the class in my custom
namespace.

I'm guessing the problem is that I haven't compiled my namespace into a dll, but I
don't have access to the command line compiler on the network PC here which doesn't
help, nor Visual Studio.

I've been told I somehow need to add a reference to my namespace if I was using Visual
Studio, but I don't have it, nor a command line compiler. Is it possible without
these?

Basically, I'm looking for an article that is entitled "how to create and reference
your own namespaces without visual studio".
I've tried putting my code behind and .cs file with my namespace in the bin directory
to no avail.

Any tips greatly appreciated
Cheers
Matt



Nov 19 '05 #4
Great, thanks Juan
Well, compiled code doesn't work by osmosis. :-)
Either you use the "src=" method, or you compile to an assembly
from the command-line, if you aren't using Visual Studio.

There's no getting around that.


So can a code behind .cs file use a "src=" to another .cs file then? One way
to find out I suppose!
Cheers
Matt
Nov 19 '05 #5

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

Similar topics

4
by: VK | last post by:
I have this code failing to work in IE: getElementsByTagName doesn't return elements from my JS namespace. What's wrong? <html xmlns:js> <head> <title>Que</title> <meta...
3
by: rdcpro | last post by:
Hi all, I've been building a nifty deserializing configuration handler that I use in conjunction with my web.config in an ASP.NET web app. This is working quite well, but I'm planning on...
1
by: Knecke | last post by:
Hi all. I have a problem with returning a custom Result object with webservice. The classes i use is described below (some fields and properties is removed) public class Result { int...
1
by: John | last post by:
Hi I have created custom membership/role/profile providers as per the web.config below. My questions are; 1. Have I defined them correctly? 2. How can I make the Login and Create User...
9
by: wardy1975 | last post by:
Hi All, Looking for a little expert advice on a few web standards issues. I am currently trying to understand the impact of web standards for a web application I work with. I have been doing a...
8
by: Mark A. Sam | last post by:
Hello I am working locally with Visual Web Developer 2005 Express. Before I even installed it, the information from Microsoft was that you could FTP it to a remote site and it should work. The...
1
by: Ryan | last post by:
I am trying to log events to SQL Server instead of the computers event log, but, although I get no errors, I have no luck. The webevents_events table is empty. I have a custom event that I am...
3
by: stevong | last post by:
Hi, I've a custom user control: 'user1.ascx <script language="VB" runat="server"> Public str1 as string Dim conn as System.Data.SqlClient ' But this line hits and error. What should I do?
1
Gulzor
by: Gulzor | last post by:
Hi, I have defined a set of custom tags that I put among regular HTML tags. E.g. <body> <div id="regular_id"> <namespace:container id="something" type="article" /> </div> </body>
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
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
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...

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.