Solved

asp.net classes in web site

Posted on 2012-04-12
4
246 Views
Last Modified: 2012-04-13
I have a fundamental question that I hope doesn't get too many laughs.

I have a web site in visual web developer express in c#. I've added a couple of class files to the app_code folder (these are 3rd party class files, I did not write them).

When I instantiate, I get an error:

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

Here's the code snippet:

    protected void Page_Load(object sender, EventArgs e)
    {

        CustomerPost newCustomer = new CustomerPost();
        newCustomer.Code = new Guid().ToString();
        newCustomer.Company = "CompanyName";
        newCustomer.FirstName = "FirstName";
        newCustomer.LastName = "LastName";
        newCustomer.Email = "test@test.com";
        newCustomer.PlanCode = PlanCodeEnum.Trial;

        Customer returnCustomer = CheddarGetter.CreateCustomer(newCustomer);
}

Open in new window


What am I missing here? I know it has to be simple :)

Thank you!
0
Comment
Question by:EffinGood
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 13

Expert Comment

by:Ashok
ID: 37840843
Customer is a class.

Do you have Customer.cs file?

Ashok
0
 
LVL 8

Expert Comment

by:PagodNaUtak
ID: 37840902
Add a reference in your project to the 3rd party class.


here is how:

http://msdn.microsoft.com/en-us/library/f3st0d45(v=vs.90).aspx
0
 
LVL 12

Accepted Solution

by:
AshleyBryant earned 500 total points
ID: 37841022
If you already have the .cs files in your AppCode folder, then you just need to add your "using" statements to the top of your code-behind so that you can use the objects.  Open up the .cs files in your AppCode folder and look for the namespace.  Copy the value of the namespace and go back to your codebehind file.  In the code behind, type in

using <namespace that you copied>;

So, if the AppCode file said this:

namespace CrazyJunk

your using statements would say:

using CrazyJunk;
0
 

Author Closing Comment

by:EffinGood
ID: 37843733
Ashley,

Thank you! That was exactly what I needed.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question