Hi all, i have a grid view control bound to a linq query result, with a boolean property to select the row (check box)
here is my code
ant the LinqCode:class WB { [ReadOnly(false)] public bool selected {get;set;} [ReadOnly(true)] public string CusCode {get;set;} [ReadOnly(true)] public string CusTitle {get;set;} [ReadOnly(true)] public string OrderNum {get;set;} [ReadOnly(true)] public string Product {get;set;} [ReadOnly(true)] public int? LocationNum {get;set;} public string Alias {get;set;} [ReadOnly(true)] public decimal? Qty { get; set; } }
WHen i tick the box i excpect the underlaying data to be updated (updates property selected to true ), but it is not for a reason that i cant work out !!Code:IEnumerable<WB> q; q= from L in DBcontext.ADV_Logs join TH in DBcontext.TRANSHEADERS on L.TransactionID equals TH.TransactionID join P1 in DBcontext.PRODUCTS on L.PrdID equals P1.UniqueID join P2 in DBcontext.PRODUCTS on L.AliasID equals P2.UniqueID join C in DBcontext.CUSTOMERS on TH.AccountID equals C.UniqueID select new WB { selected = false, CusCode = C.CustomerCode, CusTitle = C.CustomerTitle, OrderNum = TH.AccountingRef, Product = P1.ProductCode, LocationNum = L.Loc, Alias = P2.ProductCode, Qty = L.QtyOffset }; MainGrd.DataSource = q; GRD.PopulateColumns();
i even tried this, message box displays falase for all rows !
Code:foreach (WB r in q) { r.selected = true; } foreach (var r in q) { MessageBox.Show(r.selected.ToString()); }




Reply With Quote
