473,666 Members | 2,474 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Troubles reference this pointer in external class file

I'm wanting to reference page controls from a cs file in the app_code
directory. I'm getting a _Defaullt could not be found, missing
directive or assembly reference error. Very simple example below.

Default.aspx.cs :

using System;
using System.Web.UI;

public partial class _Default : Page
{
protected void Page_Load(objec t sender, EventArgs e)
{
}

protected void Button1_Click(o bject sender, EventArgs e)
{
Class1.UpdateBu ttonText(this);
}
}

----------------

Class1.cs

using System;

public class Class1
{
public Class1()
{
}

public static void UpdateButtonTex t(_Default global_Default)
{
}
}
Peter Kellner
http://peterkellner.net
Jun 9 '06 #1
2 1188
This is impossible as the App_Code directory is compiled prior to your aspx
files.

-Brock
http://staff.develop.com/ballen

I'm wanting to reference page controls from a cs file in the app_code
directory. I'm getting a _Defaullt could not be found, missing
directive or assembly reference error. Very simple example below.

Default.aspx.cs :

using System;
using System.Web.UI;
public partial class _Default : Page
{
protected void Page_Load(objec t sender, EventArgs e)
{
}
protected void Button1_Click(o bject sender, EventArgs e)
{
Class1.UpdateBu ttonText(this);
}
}
----------------

Class1.cs

using System;

public class Class1
{
public Class1()
{
}
public static void UpdateButtonTex t(_Default global_Default)
{
}
}
Peter Kellner
http://peterkellner.net

Jun 9 '06 #2
On Fri, 9 Jun 2006 23:24:03 +0000 (UTC), Brock Allen
<ba****@NOSPAMd evelop.com> wrote:
This is impossible as the App_Code directory is compiled prior to your aspx
files.

-Brock
http://staff.develop.com/ballen

Thanks,

Makes sense to me now. When I moved Class2 directly into the aspx.cs
file it of course worked. Hadn't really thought about the order of
compilation.

-peter

----------------------------------------------------

using System;
using System.Web.UI;

public partial class _Default : Page
{
protected void Page_Load(objec t sender, EventArgs e)
{
}

protected void Button1_Click(o bject sender, EventArgs e)
{
Class2.UpdateBu ttonText(this);
}
}
public class Class2
{
public Class2()
{
}

public static void UpdateButtonTex t(_Default global_Default)
{
throw new Exception("The method or operation is not
implemented.");
}
}
Peter Kellner
http://peterkellner.net
Jun 10 '06 #3

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

Similar topics

7
1548
by: James Vanns | last post by:
Sounds nasty doesn't it!! Well it's kinda what I need to do! I have an external C struct (external to the C++ project/classes etc.) which is wants a function ptr assigned to one of it's members: struct blah { int (func_ptr*) (int a, int b, float c); }; etc... However, my code is in C++ and a wish to assign a non-static member function (I know I can do this) to this struct member! Can this be
15
1740
by: Improving | last post by:
I have a template class that has static members, so in the .cpp file I have defined them with templated definitions. Now when in a different ..cpp file that includes the header file for the template class I derive a new class from the template class and pass that class as its template parameter (CRTP). Now when I instantiate this new class it complains it cannot find the statics. Doesnt the template definition define them? The code...
18
3523
by: man | last post by:
can any one please tell me what is the diff between pointer and reference.....and which one is better to use ....and why???????
22
1913
by: Ted | last post by:
This page http://homepage.ntlworld.com/r.a.mccartney/test/utf-8_test_file_hacked_for_ie_with_local_dtd.xml doesn't work properly in Firefox or IE6. The faults are different. In Firefox the TestText entity is not recognised. In IE6, the <br /> tag doesn't cause a line break. Can anyone tell me what I'm doing wrong?
0
1350
by: punjabinezzie | last post by:
I am developing an Application which currently has two XML files. One XML file with some nodes and an external entity reference to another XML file. The source XML file is being parsed using Xerces (DOM Parser), upon reaching an external entity reference node the external file being referenced does not get parsed. Instead an empty node or the current node name is substituted in place and the remaining nodes parsed from original source file...
11
4215
by: asdf | last post by:
C++ allows a reference to a pointer, but doesn't allow a pointer to a reference, why?
3
6396
by: coder | last post by:
While reading the page on "Reading C Declarations" <http://www.ericgiguere.com/articles/reading-c-declarations.html> (recommended by Mr. Heathfield at <http://www.cpax.org.uk/prg/portable/c/resources.php>), I came across the following declaration: extern char *const (*goop( char *b ))( int, long ); which is explained as:
0
1449
by: JohnIdol | last post by:
VC++6 to VC++2003 - linking troubles -------------------------------------------------------------------------------- Hi All, I successfully ported an application from VC++6 to VS2003. Solved compiling issues but now I am sticking with serious Linking troubles. I got a bunch of:
12
3009
by: Bryan Parkoff | last post by:
I write my large project in C++ source code. My C++ source code contains approximate four thousand small functions. Most of them are inline. I define variables and functions in the global scope. The global variables and global functions are hidden to prevent from accessing by the programmers. All global functions share global variables. Only very few global functions are allowed to be reusability for the programmers to use. Few...
0
8440
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8780
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7378
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6189
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5661
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2005
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.