0
所以我有一個LINQ查詢填充DataGrid:DataGrid單元格編輯事件
public class dataservice
{
[OperationContract]
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,
}
).Take<LightOrder>(500).ToList<LightOrder>();
}
}
// Add more operations here and mark them with [OperationContract]
}
public class LightOrder
{
public string SKU { get; set; }
public string productname { get; set; }
public string itemnumber { get; set; }
public string asin { get; set; }
//public Nullable<decimal> ourprice { get; set; }
public string bbprice { get; set; }
public string 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; }
}
我的問題是,如果我改變成本細胞和更改順序,我希望它告訴我總,我該如何去做,不會失去我的datagrid或寫入數據庫?
我該如何處理這個臨時變量?如果那是因爲我會爲每行添加一些東西,他們也需要是數組。 –
您可能需要使用「OnRowEditing」,從正在編輯的字段捕獲值並重新填充gridview。 –