【问题标题】:Silverlight Datagrid not properly display dataSilverlight Datagrid 无法正确显示数据
【发布时间】:2011-10-02 21:26:21
【问题描述】:

所以我在 Silver 中创建了一个自动生成列的数据网格。我调用填充此数据网格的 WCF 服务。它显示除两列之外的所有列。有谁知道是什么原因造成的?

这是填充我的类的函数

  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>();

        }
    }

这是绑定数据网格的类:

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; }
    public 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; }

}

【问题讨论】:

  • " 它显示除两列之外的所有列。"你的意思是,它只显示两列的数据?
  • @Ovais "all but" 实际上是相反的意思。除了这两列之外的所有内容。列是排名和亚马逊。

标签: c# silverlight wcf linq datagrid


【解决方案1】:

原来是班级出了问题。它似乎忽略了这些字段。

【讨论】:

    【解决方案2】:

    这 2 列是否由 [DataMember] 属性标记?

    如果你标记了它,但它们仍然没有出现,可能是服务引用没有正确生成?

    【讨论】:

    • 我对你的问题有点困惑。
    猜你喜欢
    • 1970-01-01
    • 2012-05-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-08
    • 2012-06-26
    • 1970-01-01
    相关资源
    最近更新 更多