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:
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 "using BAR" 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 "using namespace goes" 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
web page of mywebclass.aspx
This assembly and using don't seem to work. Is there a way to put it in the code-behind?
Mike
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="MIKE.MyWebClass" src="mywebclassfile.cs" %>
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 "using BAR" 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 "using namespace goes" 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="MIKE.MyWebClass" src="mywebclassfile.cs" %>
<%@ Assembly src="FOO.cs" %>
<%@ Using Namespace="BAR" %>
<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