codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Can`t Access Function from another class.  Sthefan at 22:08 on Tuesday, November 04, 2003
 

Hello,

I'm working on a CodeBehing paradigm to generate .aspx files.

Ok I know, I use directives like this:
<%@ Page language="c#" src="CodeBehind1a.aspx.cs" AutoEventWireup="false" Inherits="Project.CodeBehind" %>

and everything is ok, since I can Instantiate objects from the class located at CodeBehind1a.aspx.cs since it's in the "src" attribute

But if i want to instantiate objects from a second class located at, let me say called, CodeBehind1b.aspx.cs, but doing it (instantiate the object) inside the CodeBehind1a.aspx.cs for example? How can this be done?

For example, suppose that I have a .aspx file with this directive:

***********************************************************
// Namespace: Project, Class: CodeBehind
<%@ Page language="c#" src="CodeBehind1a.aspx.cs" AutoEventWireup="false" Inherits="Project.CodeBehind" %>

// Namespace: Projec2, Class: Codebehind2
<%@ Assembly src="CodeBehind1b.aspx.cs" %>
<%@ Import Namespace="Project2" %>
***********************************************************


I want to access the classes from both .aspx.cs files

Now inside the file CodeBehind1a.aspx.cs I try to instantiate
a object from CodeBehind1b.aspx.cs like this:

***********************************************************
Project2.CodeBehind2 b2 = new Project2.CodeBehind2();
***********************************************************



and get the error:

CS0246: The type or namespace name 'Project2' could not be found (are you missing a using directive or an assembly reference?)


What's Wrong, since I used the Assembly and Import Directive into .aspx file? I have tried to use it inside CodeBehind1a.aspx.cs:

using Project2;


But nothing...

Does someone can receive my code via mail for future check??


Thanks,

Sthefan Berwanger











CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Date script issues
•  perl script help needed
•  onChange issue
•  perl remote execution
•  Chat application
•  How to send multiple perameters in SOAP request.
•  Java code for Insert picture on the table in spreadsheet
•  Re: Problem with concatenation
•  how to genrates the crystal report by sending a id at runtime


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007