I'm trying to filter the results from an entity, but when I put two where conditions before the load it'll only filter by the first condition like so
_entity.LineItems.Where(x =>( x.EstID == Est.EstID) && (x.LineItemType == 1)).Load();
radLaborLineItems.DataSource = _entity.LineItems.Local.ToBindingList();
Also tried it like this with the same results
_entity.LineItems.Where(x => x.EstID == Est.EstID).Where(y => y.LineItemType == 1).Load();
radLaborLineItems.DataSource = _entity.LineItems.Local.ToBindingList();
In the above examples since the results are only getting filtered by the first condition I'm able to add new rows, or in other words read only is false. But when I split the conditions out, one on the load and one on the ToBindingList like this...
_entity.LineItems.Where(x => x.EstID == Est.EstID).Load();
radLaborLineItems.DataSource = _entity.LineItems.Local.ToBindingList().Where(y => y.LineItemType == 1);
The result is being filtered by both conditions, but I cant add a new row because of a data exception that says collection is read only. I've even tried manually setting the readonly and AllowAddNewRow properties, but still get a readonly error when trying to add a new row.
radLaborLineItems.ReadOnly = false;
radLaborLineItems.AllowAddNewRow = true;
So my question is how can I filter an entity by multiple conditions and still have the add new row functionality?
Also worth noting that the results are being bound to a telerik radGridView
var lineItemList = (
from e in _entity.LineItems
where
e.EstID == Est.EstID
&& e.LineItemType == 1
select new LineItemsModel{
e.EstId,
e.LineItemType
}
).ToList();
// -- Insert -- \\
lineItemList.Add(new LineItemsModel(){
EstId = 1,
LineItemType = 2
});
radLaborLineItems.DataSource = lineItemList;