How to Export to excel with filename using javascript.

Apr 6 2018 5:08 AM
 
<asp:LinkButton ID="btnexport" class="btn btn-sm btn-primary"><i class="fa fa-download" ></i>&nbsp;EXPORT</asp:LinkButton>
<script type="text/javascript">
$("[id$=btnexport]").click(function (e) {
window.open('data:application/vnd.ms-excel,' + encodeURIComponent($('#divrkapreport').html()));
e.preventDefault();
});
</script>