Hey Guys, I got some problem with dynamic linq (link) and Ajax.BeginForm. Serverside I got the following Controller Action:
[HttpPost]
public ActionResult Ajax(String filter)
{
var count = (from e in context.Elements
where(filter)
select e).Count();
return Json(new { ElementCount = count });
}
I get an exception "Syntax Error". Following the method which throws the exception from dynamic.cs
void ValidateToken(TokenId t, string errorMessage)
{
if (token.id != t) throw ParseError(errorMessage);
}
Now the strangest thing is, the same Action returns without any errors when I call it via Html.BeginForm - a non-ajax request. The following works when called via a non-ajax form.
[HttpPost]
public ActionResult NonAjax(String filter)
{
var count = (from e in context.Elements
where(filter)
select e).Count();
ViewData["ElementCount"] = count;
return View();
}
Has anyone encountered something like this - and maybe even solved it?