protected void OnError(object sender, EntityDataSourceErrorEventArgs e) { e.Handled = true; CodeFluentCoercionException cce = e.Error as CodeFluentCoercionException; if (cce != null) { string rawResult = string.Format("Raw result: {0}", cce.Value); string viewName = Utilities.GetViewName(HttpContext.Current); switch (viewName) { case "default": defaultGrid.EmptyDataText = rawResult; break; case "myview": MyViewGrid.EmptyDataText = rawResult; break; default: defaultGrid.EmptyDataText = rawResult; break; } return; } if (e.ExpectedResultType == typeof(IEnumerable)) // Select { e.Result = new CodeFluentSet(); } else { e.Result = 0; } Utilities.OnError(Page, false, e.Error); }