I have the following function that exports an HTML to excel:
function generateexcel(tableid) {
var table= document.getElementById(tableid);
var html = table.
There are two options which you could look into:
I'm not sure if you have done this already. You might need to handle something like this below in your aspx page:
$(window).load(function(){
$( "#clickExcel" ).click(function() {
var dtltbl = $('#dtltbl').html(); `enter code here`
window.open('data:application/vnd.ms-excel,' + $('#dtltbl').html());
});
});//]]>
In the above script #dtltbl is the Table Id.
The following code needs be there in your server side code, then your problem would be solved.
Response.AddHeader("Content-Disposition", "attachment;filename=myfilename.csv");