Hello,
I have created a page with a grid and a filter section. The filter section has multiple AutoCompleteBoxes with InputType on Token, every time a token is added the grid gets filtered. This page works how it should work, but the grid and the AutoCompleteBoxes work with a LinqDataSource.
I have changed the datasource from the grid and the AutoCompleteBoxes to a EntityDataSource and every time I filter the grid and go to a other grid page I get this error: The LINQ expression node type 'Invoke' is not supported in LINQ to Entities.
This is how my code works:
When a token is added in a AutoCompleteBox this event get fired:
protected void RadAutoCompleteBoxSalesOrderNumber_Event(object sender, EventArgs e) { AutoCompleteBoxEntryCollection entries = ((RadAutoCompleteBox)sender).Entries; if (entries.Count != 0) { this.salesOrderNumber = entries[0].Text; ViewState["salesOrderNumber"] = entries[0].Text; } else { this.salesOrderNumber = null; ViewState["salesOrderNumber"] = null; } }
And
this is the OnQueryCreated event the grid uses:
protected void EntityDataSourceGrid_QueryCreated(object sender, QueryCreatedEventArgs e) { IQueryable<vw_DeliveryLines> query = e.Query.OfType<vw_DeliveryLines>(); e.Query = query.Where(GetData()); }private Expression<Func<vw_DeliveryLines, bool>> GetData() { var predicate = PredicateExtensions.True<vw_DeliveryLines>(); if (!String.IsNullOrEmpty(salesOrderNumber)) predicate = predicate.And(c => c.SODocNum.Equals(salesOrderNumber)); if (salesOrderLineNumber > -1) predicate = predicate.And(c => c.SOLineNum.Equals(salesOrderLineNumber)); if (!String.IsNullOrEmpty(deliveryNumber)) predicate = predicate.And(c => c.DELDocNum.Equals(deliveryNumber)); if (deliveryLineNumber > -1) predicate = predicate.And(c => c.DELLineNum.Equals(deliveryLineNumber)); if (cardCode > -1) predicate = predicate.And(c => c.CardCode.Equals(cardCode)); return predicate; }I hope someone can help to fix my problem.