Click here to Skip to main content
15,610,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
var num;
   var uniqueName = new Date();

   var windowName = 'Print' + uniqueName.getTime();
   var printWindow = window.open(num, windowName, 'left=50000,top=50000,width=0,height=0');

   printWindow.document.write("<table id='customers'  border='1' cellpadding='0' cellspacing='0' style='width:80%; border-collapse:collapse;text-align:left'><tr><td><b>Date</b></td><td >8/8/2011</td></tr><tr><td><b>Project</b></td><td>Sample Project</td></tr></table>");
   printWindow.document.close();
   printWindow.focus();
   printWindow.print();
   printWindow.close();




how to apply css class in this case to the table that is created
i want to apply css class to this table
How to do this.
CSS
#customers tr.alt td
{
color:#000000;
background-color:#EAF2D3;
}



Please help me.

Thanks in advance
Posted
Updated 7-Aug-11 23:56pm
v2

You need to emit HTML that either includes the CSS, or loads the CSS from an external file.

Your question has nothing to do with C#.
 
Share this answer
 
JavaScript
var myTable = document.getElementById('myTable');
myTable.className = 'myClass';
 
Share this answer
 

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