Click here to Skip to main content
15,887,936 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am getting 2 different error messages and I dont know where the problem is, I know it has something to do with the first 'product' & 'productModel.GetProduct (id);'.

My code is as follows:

Private void FillPage ()
{
if (String.IsNullOrWhiteSpace (Request.QueryString ["id"]))
{
   int id = Convert.ToInt32 (Request.QueryString [id]);
   ProductModel productModel = new ProductModel ();
   Product product = ProductModel.GetProduct(id);


The last line of code contains the issue. The errors I am getting are:

Product error message

The type 'Product' in F:\Product.aspx' conflicts with the imported type 'Product' in 'App_Code.gmsjomg_, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in F:\Product.aspx'.

ProductModel.GetProduct(id) error

Cannot implicitly convert type 'Product [F:\App_Code\Model.cs (25)' to 'Product [F:\Product.aspx (12)]'

Any help would be greatly appreciated as I'm completely lost with these errors I cannot seem to get around them. Thanks


What I have tried:

i dont know where to start with tyring anything ive never had a problem like this before
Posted
Updated 23-Jan-17 20:37pm
Comments
Ehsan Sajjad 24-Jan-17 7:32am    
you have two classes with name Product, so you would need to use fully qualified name to tell which Product class is meant to be used.

1 solution

 
Share this answer
 

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