Hi Rizwan
Greetings from Syncfusion support
Based on your query, we found that you want to perform CSV exporting in the grid using the external button. To achieve your requirement we need to call the csvExport method in the button click function. Please refer the below Code Example for your reference,
Code Example :
@using Syncfusion.EJ2.Grids
@{
ViewBag.Title = "Grid Adaptor";
}
<button onclick="export()">Export</button>
@( @Html.EJS().Grid<gridmvclocalization.Controllers.OrdersDetails>("Grid").DataSource((IEnumerable<object>
)ViewBag.dataSource).AllowExcelExport().Columns(col =>{
……………………………………………..
}).AllowPaging()}).Render()
)
<script>
function export(e) {
var grid = document.getElementsByClassName('e-grid')[0].ej2_instances[0]; //Grid Instance
grid.csvExport(); //Grid Exporting
}
</script> |
Regards
Vignesh Sivagnanam