Re: custom namespaces



Hi, Matt.

Take a look at :
http://www.asp101.com/articles/john/codebehindnovs/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" <replytonewsgroups@xxxxxxxxxxxxx> wrote in message
news:%23atN3JNpFHA.3544@xxxxxxxxxxxxxxxxxxxxxxx
> 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
>


.



Relevant Pages

  • Re: Property of Custom Control
    ... Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows ... You must add a reference to assembly ... TextBoxEx.cs: error CS0234: The type or namespace name ... When I am using Desktop assemblies I have no problem ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Visibility/Access of Class Members
    ... The namespace is pretty irrelevant. ... >> The compiler can't know that the value won't be a reference to an ... the compiler should know that it's either of type Form or of type ... >> practice to have public variables in the first place. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: @import vs. @assembly
    ... For WinForms there is Project -> Add Reference to tell the compiler to ... >infer which DLL to load from the namespace alone. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Missing Tcp
    ... Type-Names have to be fully qualified within the Source-File (or Namespace). ... It also allows you to alias Namespaces or Types. ... Without setting a Reference, the compiler ... By setting the Reference you tell the compiler which to choose and where to ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: Where is System.Collections when using csc.exe
    ... Namespaces are not required to have their types completely contained within an assembly, so asking where the types for a namespace are located doesn't make much sense. ... By default, csc should make a reference to mscorlib.dll automatically, so it seems like it should work to me. ... If you compile this from the command line yourself, ... Visual Studio C# Express 2005 doesn't have a problem with them though, and can compile my code without errors. ...
    (microsoft.public.dotnet.languages.csharp)