Solved

asp.net classes in web site

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now