ASP.NET CORE MVC & jQuery: v13.3.0 .NET 8 Power Tools Version: 4.3.3
After clicking the Export To Excel button an exception is thrown on a Generated Entity using the Power Tool.
Exception:System.NullReferenceException: 'Object reference not set to an instance of an object.' Method: public FileDto ExportToFile(List<GetMyEntityForViewDto> myentities, List<string> selectedColumns) Line:foreach (var selectedColumn in selectedColumns) Issue: selectedColumns is NULL in the foreach statement Entity Base Class: FullAuditedEntity
4 Answer(s)
-
0
Any updates?
-
0
Hi @truist.software,
Sorry for the late reply. We detected the error. In the next release, it will be fixed.
-
0
Hi @truist.software,
Sorry for the late reply. We detected the error. In the next release, it will be fixed.
What are the work arounds in the mean time?
-
0
Hi @truist.software,
This error happens if you don't select any column. You can choose at least one column.
You can add following line to _ExcelColumnModal.js
this.save = function () { const exportExcelInput = _modalManager.getArgs(); exportExcelInput.selectedColumns = _modalManager .getModal() .find('input[type="checkbox"]:checked') .map(function () { return $(this).val(); }) .get(); // Fix error if (exportExcelInput.selectedColumns.length === 0) { abp.message.warn(app.localize('PleaseSelectAtLeastOneColumn')); return; } _brosService.getBrosToExcel(exportExcelInput).done(function (result) { app.downloadTempFile(result); _modalManager.close(); }); };