473,473 Members | 1,482 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ASP.Net 2.0 - App_Code Folder

hi all,

when adding a new web form in VS 2003, usually viewing the code behind for
that form will let you write any method or function and referencing any web
control placed on the form without any problems, for example writing a
function that grabs a string value from a textbox is as easy as saying:
dim str as string = me.TextBox1.Text

but with visual studio 2005 I can't do this in the simple way because the
class for
that form is placed in the app_code folder and it will not see non of the
controls on the web form, so saying:
dim str as string = me.TextBox1.Text will not work and it complains about
the TextBox1 is not defined. in more details, I have a function was working
in visual studio 2003 that calls a stored procedure in sql server 2005, this
function passes a variables (3 variables) from a 3 textboxes on the form.
And I am calling this function everytime the user changes the value of one
of these textboxes.

now since the migration, visual studio 2005 puts all classes under Ap_Code
folder (as one of their new features!!) moving my function under the
App_Code folder prevents me from calling/Getting the values of those
textboxes as they change why? because the class can't see those controls
sitting on the form!

thanks for your help.
Jan 18 '07 #1
1 2216
Hi netasp,

You can find more information about common ASP.NET 2.0 conversion issues
and solutions here:

#Common ASP.NET 2.0 Conversion Issues and Solutions
http://msdn2.microsoft.com/en-us/library/ms972973.aspx
From the document, you will see following changes are related to your issue:

--------------------
In ASP.NET 1.x, the graphical components were typically separated from the
coding components using an .aspx page and a code-behind file. The .aspx
page is derived from the code-behind file. This means that you have to
declare all your controls in both classes in order to properly wire up the
callback events. The inheritance relationship also caused some problems
with synchronizing the classes, especially when a developer made a change
to the .aspx (such as adding a control), without making the necessary
changes to the code-behind or recompiling the application.

In ASP.NET 2.0, the code separation model has changed, thanks to the advent
of a concept known as the partial class. The partial keyword lets you split
the code for a single class into two separate files. The code-behind file
defines a partial class that contains user code. The designer will also
generate a stub file containing a partial class that defines the field
declarations for the controls used in the aspx page. When compiled, the
.aspx page will derive from the combined partial classes, and be compiled
into its own page assembly. This design reduces the risk of inadvertently
breaking the page by editing designer-generated code.

The conversion wizard updates your application by moving all standalone
code to the App_Code directory.
--------------------
I think maybe some of your code are standalone and therefore they're
migrated to App_Code. However, based on my test, if the code file is a
CodeBehind class for a WebForm, it will not be migrated to App_Code.

Would you please create a simpler reproducible VS2003 web project and send
it to me? I can verify the migration behavior on my side. Thanks.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 19 '07 #2

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

Similar topics

11
by: Steve Franks | last post by:
I'm using VS.NET 2005 Beta 2. I have a helper C# class I wrote that I placed in my /App_Code directory. Everything runs fine locally. However when I use the "Copy Web" function to upload the site...
5
by: Jay Douglas | last post by:
I have a set of pages that inherit from a base class in the App_Code folder. The class looks something like: public class MyBaseClass : System.Web.UI.Page In various stages of the life cycle I...
8
by: Umut Tezduyar | last post by:
I know that, in asp.net 2.0, the assembly for the web site is splitted into pieces and each time you build it, it generates a random name for assembly. My question is, if i create a custom web...
4
by: Filip De Backer | last post by:
Hi everyone, I've created 5 (different) asp.net 2.0 applications. Each applicationfolder contains an App_Code folder. Is it possible to set the App_code folder in de root of the website?...
2
by: walter | last post by:
Hi, when I add a new page in my asp.net 2 project and put some controls there, everything works fine until I move the code behind into App_Code folder.--When I compile , it tells me that control...
3
by: Howard | last post by:
I have two websites that basically use the same data access layer. the code in the app_code folder are identical for these two website. Each has a different presentation layer (html stuff). It's a...
2
by: pradeep_TP | last post by:
Hello, I am trying to use APP_CODE folder for all my class files under VS 2005. After adding APP_CODE in the solution explorer, I added a new web page by right clicking project and selecting add...
1
by: matt.merchant | last post by:
All, When publishing a site with the "Used Fixed Naming and Single Page Assemblies" option checked, only one of my two App_Code folders are compiled into .DLL's. The original code (DotNetNuke...
0
by: Rotsey | last post by:
Hi, I have a web site being developed with VS2005. I am upgrading a VS2003 application by copying each page one at a time and fixing problems. Also I have copied across my class object code...
1
Frinavale
by: Frinavale | last post by:
I created a custom class that inherits from the CheckBoxList. I placed the the code for this in the App_Code folder because it's used through out my web application. I ran into a namespace...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
1
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...
0
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...
0
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,...
1
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...
0
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...
0
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...
0
muto222
php
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.