CodeBehind Class Not Accessible To Code In App_Code Folder?

Jan 31, 2010

I have a PlannerShiftView user control in the root folder of my ASP.NET web site. In my App_Code folder, I have a ShiftViewTemplate class that needs to instantiate a PlannerShiftView (for a TemplateField in a GridView). The problem is, the following code doesn't compile because the PlannerShiftView type is not available in what I deem to be the App_Code 'phantom namespace'.

Please can somebody explain to be what is happening here, as well as what to do. I know I can just move the ShiftViewTemplate out of App_Code, going against convention and without explantion, but that is something of a hollow victory.

View 1 Replies


Similar Messages:

Class In App_Code Not Accessible By Global.asax.cs Error - Namespace Name 'MyClass' Could Not Be Found

Nov 18, 2010

I've created a new class in App_Code

namespace Site {
public class MyClass {
public MyClass() {
}
}
}

this is my Global.asax.cs

[code]....

The error is in: MyClass myClass = new MyClass();

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

View 1 Replies

Get Page Title Inside Class In App_Code Folder

May 5, 2010

I guess I might be missing something easy (or not) here. I have a class in App_Code which do some validations over Session and Request.Url, till here it's working fine. But then I need to get the actual page title. I know it's simple to get it in the page's code behind, but could I get it in a separate class like it is on my scenario?

View 8 Replies

Architecture :: Access Class Files Not In App_Code Folder

Feb 25, 2010

I have a single project. and I have two folder in it. In the 1st folder I have a class named Class1 and in the 2nd folder I have a class named Class2. Can anyone tell me how I can access members of Class1 in Class2. I have tried by adding namespace in Class1 and Using that namespace in Class2. But it is giving error. It is easy to access classes or their members from App_Code folder. I don't want to put my classes in app_code folder.

View 3 Replies

State Management :: How To Use ViewState In Class Inside(App_code) Folder

Aug 23, 2010

i want to do some thing like this in in Class inside(App_code) folder i want to know how to do it with

Correct Syntax :
public static void GetViewStateValue(int StudentID,ViewState MyViewState)
{
if(MyViewState["Name"]!=null)
{
}
}

View 7 Replies

Localization :: Access Resource String From Class In App_Code Folder?

Mar 8, 2011

Or any class that's not X.aspx.vb. I've imported the Globalization, Threading, Threading.Thread, and UI.Page namespaces. But it won't come up in Intellisense and it gives error lines in my code. Is there a way to access use the GetLocalResource("Y") method in other classes?

View 3 Replies

Configuration :: CS0103 Error When Calling Class Contained In App_Code Folder

Nov 18, 2010

I have created a simple ASP.NET Website in Visual Studio 2008. I have a static C# class (lets call it someClass) contained in a separate file in the App_Code folder. I call a method from that class in my page's code behind like so:

someVar = someClass.someMethod(someParam);

This compiles correctly in VS 2008 but when I move it over to my IIS server, I get the following error (CS0103): Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0103: The name 'someClass' does not exist in the current context I have created a virtual directory for this website enabling 'Read', 'Run scripts (such ASP)', and 'Execute (such as ISAPI applications or CGI)'. I am not currently utilizing namespaces (as I thought I would not need to and I'm not sure how to use them properly). What am I doing wrong?

View 1 Replies

Unable To Debug Code In App_Code Folder?

Feb 12, 2010

I appear to have hit a brick wall whilst attempting to debug some C# code that resides in the App_Code folder.We have an established ASP.NET solution and I've just been brought onto the team. Unfortunately when I run the code [which successfully debugs (to a certain extent)] it does not step into a *.cs file that exists in the App_Code folder.I've found several posts on the subject, none of which seem relevant to me.

Specifically:

Running Win7 Enterprise 32 bit VS2005 8.0.50727.867 (vsvista.050727-8600) http://forums.asp.net/p/958358/3675792.aspx#3675792 mentioned removing the "+optimize" in the web.config file; this doesn't seem to be relevant to me (<compiler language="c#;cs;csharp" extension=".cs" compilerOptions="/d:TRACE"
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>)
The "App_Code" folder doesn't seem to have any peculiar setting associated with it

I also said that debugging works successfully "to a certain extent". I've set up Visual Studio with the C# developer environment. When I hit F11 I would expect the IDE to begin debugging and for the execution point to stop on the very first line of code (this is what it does in all my other projects in VS2003 & VS2008). However, when I hit F11 it acts like F5, running until it either hits a break point or a run-time error. I'm wondering whether this may be related to it not even hitting break-points in code in my App_Code folder?

View 2 Replies

Visual Studio :: Web Site App_Code Classes Not Accessible?

Aug 5, 2010

I am fairly new to ASP.net and web page development. I normally create Windows Apps, but the move is on to web pages. I have read and tried a number of posts on this matter, but none of them resolved the problem I am having. I have created a web site (I'm positive it is a web site) and added a class. Visual Studio automatically created and added the class to the App_Code folder. Accordingly, I added the get/set methods to the class and made them public. When ever I try to access the class from a code behind for any page, I get the class name, but nothing more. Intellisense shows only Equals and EqualsReference - no variables. I'm used to using classes in windows forms application and this would make life so much easier if it worked like it is supposed to work.

View 2 Replies

C# - Moving Code From Codebehind To Class File?

Jul 17, 2010

For some time now I am trying to figure out how I can refactor some of my code to reduce redundancy throughout my application. I am just learning the basics of OOP and can create simple classes and methods but my knowledge is limited in terms of practical applicability. The following bit of code illustrates my frustration:

[Code]....

This bit of code is used on several pages of my project in the pages codebehind file. How can I move this to a class file. I don't know how to reference an object like a gridview in a class because it does not exist like it does on the actual page.

View 2 Replies

Cant Get Class In App_Code To Work In Code Behind Page For Simple Page?

Jun 8, 2010

just a quick question -i cant get my class in App_Code to work in my code behind page for simple .net page, some light what doing wrong?

[Code]....

View 7 Replies

List All Classes In Application (Including Class In App_Code And Partial Class(aspx Pages And Asmx User Controls)?

Nov 15, 2010

Is there any way to list all the class in my ASP.Net application(Including class in App_Code and Partial Class(aspx pages and asmx user controls)

View 3 Replies

App_code Folder In 3.5?

May 22, 2010

Can any one explain me about App_code folder? AND i want to put some .cs files in that folder. But i coud not see the folder. HOw to add?

View 4 Replies

Why Use App_code Folder

Nov 18, 2010

any one explain me why use classes inside app_code folder or which file add inside this folder and what is the logic of that file and how they work?

View 3 Replies

App_Code Folder Get Ignored By Compiler?

Oct 5, 2010

I've noticed that with some, but not all sites, if I add a class in a .cs file in the App_Code folder, then I can't reference the class anywhere. In some sites, this isn't a problem. If I move the .cs file to the root, then no problem. Anyone able to explain what's going on here? I have a mixture of sites created in VS2010, along with ones that existed before I got it. Don't know if this makes any difference. More to the point, how do I persuade VS2010 (and I suppose IIS ultimately) to allow .cs files in App_Code, as I find this much neater than having class files littered around the root.

View 6 Replies

App_Code Folder Does Not Work?

Jul 28, 2010

I have a question. When I create my website using vwd 2008 express, I can not create App_Code folder, actually there's no selection for App_Code folder when I right click on my website(only Theme, App_Resources, App_LocalResources, App_GlobalResources and disabled App_Data).

I try to add new folder and name it App_Code, then put a class in there. But I can reference to it in my code behind.

Is there something wrong with my VWD installment or this is not supported by Express version?

View 3 Replies

App_Code Folder Is Missing In VS 2010

Feb 17, 2010

I was trying to create a Dynamic Data Website using VS 2010 RC. An attempt to create an App_Code folder where I would put a LINQ to SQL class, failed. When I selected 'Add ASP.NET Folder' to add the folder, I had options to create only the following folders:

App_GlobalResources
App_LocalResources
App_Data
App_Browsers
Theme

What happened to the App_Code folder?

View 3 Replies

App_Code Folder Of Project Contain Both C# And VB# Classes?

Sep 17, 2010

Using vb.net/asp.net 2005. I have a project that is done with all vb.net, however I want to get some more experience with C#.Net. I am considering creating a new database class to put in the app_code folder.

View 3 Replies

What Is The Best Way To Separate Classes Under The App_Code Folder

Aug 10, 2010

I have an application which contains different modules from different databases, for instance, I have a table called "ITEMS" in each database. When I create the classes for the table ITEMS I wonder how I can differentiate among them.

For instance, for now, I have "ItemDetails.cs" under App_Code folder BUT I need to create another "ItemDetails.cs" class which will reference the table ITEMS from a different database. If I create folder under the App_code the class name still remains the same.

I could add an acronym in front the class to differentiate which database I am working from but that makes the class name too long.

View 2 Replies

App_Code Folder In Project In VIsual Studio 2010

Jun 22, 2010

at vs2008 i could set App_Code folder, but at vs2010 i can not do it, that's why i put my dataset's and class' to App_Data folder. Either I do not know even App_Data folder is secure?

View 4 Replies

Web Forms :: How To Access Classes Or Their Members From App_Code Folder

Apr 27, 2010

I have a single project. and I have two folder in it. In the 1st folder I have a class named Class1 and in the 2nd folder I have a class named Class2. Can anyone tell me how I can access members of Class1 in Class2. I have tried by adding namespace in Class1 and Using that namespace in Class2. But it is giving error. It is easy to access classes or their members from App_Code folder. I don't want to put my classes in app_code folder.

View 5 Replies

Visual Studio 2010 C# And Classes In App_Code Folder?

Jan 7, 2011

I've searched but not found much that helps, could be using wrong search terms.Anyway, currently using Visual Studio 2005 and VB, but just got Visual Studio 2010 and trying to use C# and am having problems using classes, I think I'm missing something simple here.

In both 2005 & 2010 I create a new website and a Default.aspx, in 2005 using VB, C# in 2010.

Right-click the project -> Add New Item -> Class, and leave it as Class1.vb/Class1.cs

Both 2005 & 2010 prompt to place it in the App_Code folder, so choose yes.

Here are the class files, I've not changed anything apart from create a very simple function:

Class1.vb code: [Code]....

Class1.cs code: [Code]....

In my VB project Default.aspx.vb: [Code]....

No errors, and debugging shows that a = "hello"

My Default.aspx.cs: [Code]....

This gives an error:Error 1 The name 'tester' does not exist in the current context D:Visual Studio 2010WebSite11Default.aspx.cs

How do I reference the tester function within Class1 in my C# project?

View 4 Replies

C# - Can Have A Section Of App_Code Which Compiles Separately From The Rest Of The Folder

Jan 25, 2011

We have a website with a huge amount of Cached objects stored in static variables within App_Code. Whenever we push an App_Code change to our production webservers it recycles the IIS pool and flushes the cache. It does not flush the cache however when we push out changes to .aspx and .aspx.cs files.

I need to have a bunch of classes that will be updated several times a day to be able to be referenced in App_Code. I would like either a section of my App_Code which I can update several times a day without cycling IIS and flushing my cache, or the ability to reference classes outside of App_Code from within App_Code.

View 2 Replies

Visual Studio :: The App_Code Folder And Recycling Samples?

Feb 14, 2010

I am a developer who up until now only used WAP assemblies. Is that old and outdated nowadays? For example I have found a really great sample of google map API I'l like to use but my project is in VB.NET and the sample is using code in App_Code folder in C# so I cannot mix and integrate in a easy way. Do I have to convert the C# code into VB.Net to make it work or is there a shortcut when finding sample code in App_Code folder in the wrong code language?

View 1 Replies

Can't Use Class In .cs File Under App_code?

Apr 10, 2010

I've developed a class and it is put in a .cs file under the app_code folder. The class is a public one and there is no namespace specifically defined for this class in the file.of my webpages uses this class. It works ok on my local machine. However after I uploaded the page to the web server and then try to display the page through internet, the sever told me the class name can not be found.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved