Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
195
Export to Excel possible with list from model in view ASP.NET MVC?
posted

I'm working on a ASP.NET MVC application where I have a custom made table with data from a list in the model that I pass into the view. This data is not in a grid of Infragistics. I want to export this data to Excel. 

Currently I have this in my Javascript: 

$("#btnExportToExcel").click(function () {

console.log("exporting to Excel");
$.ig.GridExcelExporter.exportGrid("@Model.labortimeReports)",
{ fileName: "bookreport_" + $('#startDateDatePicker').val() }, { } );

});

I'm trying to pass the list from my model for exporting it to Excel, but is does not work.

Is it possible to export this list to Excel without having to create a grid for this?

Or am I using the wrong version(s)? I'm currently using these:

<!-- Ignite UI Required Combined CSS Files -->
<link href="">cdn-na.infragistics.com/.../infragistics.theme.css" rel="stylesheet">
<link href="">cdn-na.infragistics.com/.../infragistics.css" rel="stylesheet">

<!--Required scripts-->
<script src="">igniteui.com/.../script>
<script src="">code.jquery.com/.../script>
<script src="">code.jquery.com/.../script>

<!-- External files for exporting -->
<script src="">www.igniteui.com/.../script>
<script src="">www.igniteui.com/.../script>

<script type="text/javascript" src="">cdn-na.infragistics.com/.../script>
<script type="text/javascript" src="">cdn-na.infragistics.com/.../script>
<script type="text/javascript" src="">cdn-na.infragistics.com/.../script>
<script type="text/javascript" src="">cdn-na.infragistics.com/.../script>
<script type="text/javascript" src="">cdn-na.infragistics.com/.../script>
<script type="text/javascript" src="">cdn-na.infragistics.com/.../script>

I also have tried to create an igGrid with this data and hide this. But I still can't export to excel. I get this error: