Seven price
asked on
but this dictionary requires a model item of type
The model item passed into the dictionary is of type 'System.Collections.Generi c.List`1[M obileWeb.M odels.Prod uctDetails Model]', but this dictionary requires a model item of type 'MobileWeb.Models.ProductD etailsMode l'.
Keep receiving this error, I see the data when it reaches the return view but I get this error.
Keep receiving this error, I see the data when it reaches the return view but I get this error.
public class ProductDetails
{
public List<ProductDetailsModel> data { get; set; }
}
public class ProductDetailsModel
{
public string datanumber { get; set; }
public string name { get; set; }
public string description { get; set; }
public string number { get; set; }
public float avg_price { get; set; }
}
Stream objStream;
objStream = wrGETURL.GetResponse().GetResponseStream();
StreamReader objReader = new StreamReader(objStream);
string sLine = "";
int i = 0;
WebResponse response = wrGETURL.GetResponse();
string contentType = response.ContentType;
//while (sLine != null)
//{
// i++;
sLine = objReader.ReadLine();
JObject o = JObject.Parse(sLine);
// Console.WriteLine("description: " + o["description"]);
List<ProductDetailsModel> mydata = new List<ProductDetailsModel>()
{
new ProductDetailsModel { description = (o["description"]).ToString() }
};
return View(mydata.AsEnumerable());
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok I need a little help with that, I can do that from a database but I have the data with sLine
how can I return the data description with this list
how can I return the data description with this list
List<LookupTable> mydata = new List<LookupTable>()
{
new LookupTable { description = (o["description"]).ToString() }
};
ASKER
Ok it was simple I just had to
var model = new context
{
description =(o["description"]).ToStri ng()
};
var model = new context
{
description =(o["description"]).ToStri
};
ASKER
Open in new window
Object reference not set to an instance of an object.Recieving this error now