We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


ASP.Net ObjectDataSource Issue

Medium Priority
Last Modified: 2012-05-11
Dear Friends,

Please refer to the below link to understand my question.


We have an AuthorsDB.cs in App_Code folder.

If I move the AuthorsDB.cs from the App_Code folder to and my application folder and run the example I get the following error.

The type specified in the TypeName property of ObjectDataSource 'ObjectDataSource2' could not be found.

But when I put AuthorsDB.cs back into the App_Code it works perfectly.

My question is what if I dont want my class files in App_Code but in my own defined folder then what changes is required to make the application work.

Thank you
Madhu Menon
Watch Question

Paul JacksonSoftware Engineer
Top Expert 2011

The App_Code folder is a special folder used to hold class files that get compiled so that the code can be used by other pages in your solution. If you move the class file to another folder it won't get compiled hence why you get the error described.
The only alternative is to create a Class Library project within your solution and move the class files into the class library. You will then have to add a reference to the class library in your project and you can call the code from your project.
Ephraim WangoyaSoftware Engineer


Copy AuthorsDB.c to the folder you want to be

Right click on the file and remove the item from App_Code

Right click on the folder you copied it to and select Add Item then choose the file

Save project

(Make sure you copy it before removing)
Senior Systems and Integration Developer
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview


Thank Carl
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.