1
Vote

DynamicLinqDataSource.OnSelecting e.Result

description

Specifing your own e.Result in the Selecting event of DynamicLinqDataSource is lost. It's overwritten by the override method "protected override void OnSelecting(LinqDataSourceSelectEventArgs e)".
 
Suggested solution in DynamicData\DynamicLinqDataSourceView.cs
 
protected override void OnSelecting(LinqDataSourceSelectEventArgs e)
{
...
 
instead
        LinqDataSourceContextData data = CreateContextAndTable(DataSourceOperation.Select);
        IQueryable source = AsQueryable(data.Table);
 
use
      IQueryable source;
 
      if (e.Result == null) 
      {
        LinqDataSourceContextData data = CreateContextAndTable(DataSourceOperation.Select);
        source = AsQueryable(data.Table);
      }
      else 
      {
        // use your specified e.Result
        source = AsQueryable(e.Result);
      }
 
...
}

comments

jheyse wrote Dec 3, 2008 at 11:31 PM

Excellent catch and suggestion. Thanks for the submission. I will make sure this gets into the next release.

wrote Feb 14, 2013 at 3:41 AM