Sort a collection using linq or lambda expression and assign to collection -
i have sort collection based on sort-order field collection. did following way.
var objresult = err in ibussofterrors.iclbemployererror join codvalue in lclbcodevalue on err.severity_id equals codvalue.icdocodevalue.code_id orderby codvalue.icdocodevalue.code_value_order select ibussofterrors.iclbemployererror;
ibussofterrors.iclbemployererror collection use in grid. problem when try assign query result collection getting following error.
cannot implicitly convert type 'system.collections.generic.ienumerable<>' 'system.collections.objectmodel.collection<>'. explicit conversion exists (are missing cast?)
help me out collection sorted using lambda or linq.
binding requires ilist implementation so
var objresult = err in ibussofterrors.iclbemployererror join codvalue in lclbcodevalue on err.severity_id equals codvalue.icdocodevalue.code_id orderby codvalue.icdocodevalue.code_value_order select err; var tobind = objresult.tolist(); grid.itemssource = tobind;
should (assuming wpf/silverlight datagrid)
Comments
Post a Comment