Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I Exported the data through clientside in if else conditions .
But yet i hav som doubts in it.

So i need the complete export excel solution.

Anyone help me out of tis !!!
Posted
Updated 27-Jan-22 1:37am
Comments
Maciej Los 20-May-14 2:19am    
Help what?
Joseph 10797335 20-May-14 5:41am    
i got coding with fully on servide oly , so pls provide me with client side script.

 
Share this answer
 
C#
var table = ($('#GrdAccountTypesListView').get(0))
   var uri = 'data:application/vnd.ms-excel,'
           var data = [];
           var headers = [];
           for (var i = 0; i < table.rows[0].cells.length; i++) {
               headers[i] = table.rows[0].cells[i].innerHTML.toLowerCase().replace(/ /gi, '');
           }
           for (var i = 0; i < table.rows.length; i++) {

               var tableRow = table.rows[i];
               var rowData = {};
               for (var j = 1; j < tableRow.cells.length-1; j++) {

                   rowData[headers[j]] = tableRow.cells[j].innerHTML;

               }

               data = rowData;
}
          document.getElementById("dlink").href = uri + data;
         document.getElementById("dlink").download = 'AccountTypesListView.xlsx';
            document.getElementById("dlink").click();


It's exporting the data but its saved as object in Excelsheet.

eg: [object][object]

Pls find some solution fr me .
 
Share this answer
 
Comments
Maciej Los 20-May-14 13:11pm    
Not an answer. Please delete it to avoid down-voting.
Joseph 10797335 21-May-14 5:41am    
ya ma solution is wrong can you check n verify it Pls.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900