I've written a .cs class inside the App_Code folder in an ASP.NET project. It compiles fine. However, when I try to inherit from it from a .aspx.cs file, which is located inside the project but outside of any folder, I get a compile error: "The type or namespace
name '...' could not be found (are you missing a user directive or an assembly reference?)". How can I solve it?
Is there some connection to the Inherit property at the .aspx markup file? It's the last property of the first line. But I tried to change it and it doesnt seem to help.
shai44
Member
99 Points
55 Posts
App_Code folder
Jan 20, 2012 04:07 AM|LINK
Hello.
I've written a .cs class inside the App_Code folder in an ASP.NET project. It compiles fine. However, when I try to inherit from it from a .aspx.cs file, which is located inside the project but outside of any folder, I get a compile error: "The type or namespace name '...' could not be found (are you missing a user directive or an assembly reference?)". How can I solve it?
I'm using ASP.NET 4 and Visual Studio
me_ritz
Star
9337 Points
1447 Posts
Re: App_Code folder
Jan 20, 2012 04:10 AM|LINK
Make sure you app_code class is public.
rohitpundlik
Contributor
3102 Points
934 Posts
Re: App_Code folder
Jan 20, 2012 04:18 AM|LINK
Plz make your class as Public Class......
Rohit Pundlik
Please mark as answer if this helps you...
celinajohn
Member
182 Points
52 Posts
Re: App_Code folder
Jan 20, 2012 04:20 AM|LINK
Hello,
Is you appcode class public?
mkruluts
Member
62 Points
22 Posts
Re: App_Code folder
Jan 20, 2012 04:21 AM|LINK
As stated above, make sure the app class is public... also make sure you add a reference to the class.
Prince Sriva...
Contributor
2290 Points
419 Posts
Re: App_Code folder
Jan 20, 2012 04:26 AM|LINK
Your class file are any folder of APP_Code
if yes then please use namespace in your .cs code
like if your class file is in folder DAL then
use namespace
using DAL ;
and be sure that there the class file are public .
if this will help you marka as answer
My Blog
ROHIT KUMAR SRIVASTAVA
shai44
Member
99 Points
55 Posts
Re: App_Code folder
Jan 20, 2012 04:42 AM|LINK
My class is public, but I don't know how to add to the references.
shai44
Member
99 Points
55 Posts
Re: App_Code folder
Jan 20, 2012 04:45 AM|LINK
The class is directly inside App_Code. It is public. When I write using App_Code, I get compile error. Sorry, don't know what you mean.
shai44
Member
99 Points
55 Posts
Re: App_Code folder
Jan 20, 2012 04:49 AM|LINK
Is there some connection to the Inherit property at the .aspx markup file? It's the last property of the first line. But I tried to change it and it doesnt seem to help.
rohitpundlik
Contributor
3102 Points
934 Posts
Re: App_Code folder
Jan 20, 2012 04:51 AM|LINK
Can you pls share your code, both class file and .aspx code ??
Rohit Pundlik
Please mark as answer if this helps you...