Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public class CustomerController : Controller
{
   …..
   ….
   public ViewResult DisplayCustomer()
   {
      Customer objCustomer = new Customer();//i can not creat an object of this class bcoz i can not find this Customer class here so how to find this class here..?
      objCustomer.Id = 12;
      objCustomer.CustomerCode = "1001";
      objCustomer.Amount = 90.34;

      return View("DisplayCustomer",objCustomer);
   }
}


please solve my comment part of this code
what is missing so i can not find "Customer" class here...
Posted
Updated 2-Mar-12 5:42am
v2

You need a using statment for the namespace that Customer belongs to at the beginning of the module code. If it is in the same project, then you do not need to have a reference to the project containing the definition of Customer (in the references folder under the root of the project). Otherwise you need to add a reference by right clicking the references folder and selecting "Add Reference...". Projects within the folder will appear under the Projects tab, which is the top left tab.
 
Share this answer
 
I'm sure this is way to simple so can't be what you are looking for but it seems to me that you are attempting to instantiate a class that does not exist in your project. Either include a file (probably called Customer.cs) in your project or create the Customer class with all of the appropriate properties, etc., that your solution requires.

Read this[^].
 
Share this answer
 
Comments
Member 8693833 2-Mar-12 11:28am    
yeah thnks i didnt add class library ........
thnk u

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900