Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't use namespace problem

Status
Not open for further replies.

motte

Programmer
May 31, 2001
155
US
Hi everyone,

I've done this in asp.net using vb, but can't get this done in c#. I am not using visual studio. This is done in a text editor.

What I have is a .aspx page with a .cs code-behind.
The .aspx page inherits the .cs file like so:
Code:
<% @Page inherits=&quot;MIKE.MyWebClass&quot; src=&quot;mywebclassfile.cs&quot; %>

The .cs file is of namespace MIKE, class of MyWebClass.

I have created a new class (FOO in FOO.cs) with namespace (BAR). I want to use this in my .cs file. How do I include it? I tried &quot;using BAR&quot; in the .cs, but I need to make an assembly reference to the FOO.cs file.

Do I need to make an assembly ref in the code-behind .cs file or in the .aspx file? How do I do this? Like I said, it worked in vb, but not c#.

If anyone can show me where the &quot;using namespace goes&quot; and the assembly reference goes, and how to correctly write them, I'd appreciate it.

Mike

Here are the tops of 2 files:
code-behind mywebclassfile.cs
Code:
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Collections;

namespace MIKE {

web page of mywebclass.aspx
Code:
<% @Page inherits=&quot;MIKE.MyWebClass&quot; src=&quot;mywebclassfile.cs&quot; %>
<%@ Assembly src=&quot;FOO.cs&quot;  %>
<%@ Using Namespace=&quot;BAR&quot; %>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>

This assembly and using don't seem to work. Is there a way to put it in the code-behind?

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top