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
Solved

asp.net classes in web site

Posted on 2012-04-12
4
244 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
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

837 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