?
Solved

asp.net classes in web site

Posted on 2012-04-12
4
Medium Priority
?
248 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 2000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 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