Solved

asp.net classes in web site

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

Technology Partners: 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…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 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