Silverlight Datagrid not properly display data
So I made a datagrid in Silver that auto-generates columns. I call a WCF service that fills this data grid. It displays all but two of the columns. Does any know what causes this?
Here is the function that fulls my class that is bounded to
public List<LightOrder> GetOrder(string code)
{
// Add your operation implementation here
using (amazonproscoutEntities context = new amazonproscoutEntities())
{
return (from c in context.AmazonSKUs
where c.MerchantSKU.StartsWith(code)
select new LightOrder()
{
SKU = c.MerchantSKU,
productname = c.ItemName,
asin = c.ASIN,
//ourprice = c.OurPrice,
bbprice = c.Price,
quantity = c.TotalQty,
rank = c.Rank,
amazon = c.Amazon,
afner = c.AFNer
//w1 = c.w1
}
).Take<LightOrder>(500).ToList<LightOrder>();
}
}
This is the class that is bound the the data grid:
public class LightOrder
{
public string SKU { get; set; }
public string productname { get; set; }
public string itemnumber { get; set; }
public string asin { get; set; }
public string amazon { get; set; }
p开发者_StackOverflow社区ublic decimal ourprice { get; set; }
public string bbprice { get; set; }
public int w1 { get; set; }
public string w2 { get; set; }
public string w3 { get; set; }
public string w4 { get; set; }
public int quantity { get; set; }
public string pendingorder { get; set; }
public string afner { get; set; }
public string order { get; set; }
public string total { get; set; }
public string profit { get; set; }
public string percent { get; set; }
public string rank { get; set; }
}
Are these 2 columns marked by the [DataMember] attribute?
If you marked it, and they are still not appearing, maybe the service reference wasn't generated properly?
It turns out it is the class that is having the issue. It has seemingly ignored those fields.
精彩评论