Excel Export Controller

Hi,

I'm trying to use your ExportController to do excel export.
I'm using EntityFramework.
I get a trouble with the 'ApplyQuery' method
i get this message :


I think it comes fom my entity but did you have already get this kind of trouble ?

Regards,

pls post the .cs code which calls the ApplyQuery method to comment further

HI,

here is :
using DBAccessEFCore;
using DBAccessEFCore.Models.ElectionCentral;
using DBAccessEFCore.Models.Stage;
using DBAccessEFCore.Reports;
using Election_Manager.Services;
using System.Reflection;
using System.Resources;
using System.Text.RegularExpressions;

namespace Election_Manager.Controllers
{
public partial class ExportEFDataFactoryController : ExportController
{
private readonly EFDataFactory eFDataFactory;
private readonly ECSession _sess;
private readonly ElectionCentralContext _context;
private readonly StageContext _contextstage;
public ExportEFDataFactoryController(EFDataFactory eFDataFactory, ECSession _sess, ElectionCentralContext context, StageContext contextstage)
{
this.eFDataFactory = eFDataFactory;
this._sess = _sess;
this._context = context;
this._contextstage = contextstage;
}
ResourceManager rm = new ResourceManager("Election_Manager.Language.Resource", Assembly.GetExecutingAssembly());
[HttpGet("/export/exportefdatafactory/voter/excel/{sessionGuid}/{languageCode}/{currentElectionEventID}/{ownerid}/{adminid}/{filename}")]
public FileStreamResult ExportVoterToExcel(string sessionGuid, string languageCode, string currentElectionEventID, string ownerid, string adminid, string filename)
{

        return ToExcel(ApplyQuery(_contextstage.VoterData, Request.Query), filename);
    }

}
}

For more information, i get this error message :

pls refer to this sample for further details
Blazor DataGrid Component - Export to Excel and CSV | Free UI Components by Radzen

Hi,
I implement this sample in my solution like that :

image

Unfortunately, i get the same result :

Apparently something in the $select argument causes the problem. Try investigating what that is.

Hi,
In point of fact, my grid is based on dictionnary datasource like in your sample :Blazor DataGrid Component - Dynamic Data | Free UI Components by Radzen.
Maybe it's a trouble to export in excel ?

Regards,

Yes, definitely that’s the problem. You can remove Select definitions from the Query.