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.
Hello,
i'm having trouble with kendo ui events handler.
When an error has been throwed from controller to the request response, the error is showed on an alert, like this:
@(Html.Kendo().Grid(Model)
.Name(
"grid"
)
.Events(e => e.Error(
"error"
)
//another declarations
function
error (args){
if
(!args)
return
;
if
(args.errors) alert(args.errors)
}
public
class
Contact
{
[UIHint(
"PhotoFileNameEditor"
)]
public
string
PhotoFileName {
get
;
set
; }
}
}
@(Html.Kendo().Upload()
.Name("PhotoFileName")
.Multiple(false)
.Async(async => async.Save("SavePhoto", "Contact").Remove("RemovePhoto", "Contact").AutoUpload(true))
)
public
ActionResult SavePhoto(IEnumerable<HttpPostedFileBase> PhotoFileName)
{
if
(PhotoFileName !=
null
)
{
foreach
(var file
in
PhotoFileName)
{
var fileName = Path.GetFileName(file.FileName);
var physicalPath = Path.Combine(Server.MapPath(
"~/Images/"
), fileName);
file.SaveAs(physicalPath);
}
}
return
Content(
""
);
}