Click here to Skip to main content
16,004,529 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I need my page in table format.

What I have tried:

JavaScript
var prtWindow = window.open(windowUrl, windowName,
        'left=100,top=100,right=100,bottom=100,width=700,height=500');
    prtWindow.document.write('');
    prtWindow.document.write('');
    prtWindow.document.write(gridData.outerHTML);
    prtWindow.document.write('');
    prtWindow.document.close();
    prtWindow.focus();
    prtWindow.print();
    prtWindow.close();
Posted
Updated 1-Jul-18 0:49am
v2
Comments
Richard MacCutchan 29-Jun-18 8:51am    
Is there a question here?
Richard Deeming 29-Jun-18 9:10am    
REPOST
You posted exactly the same thing three days ago:
https://www.codeproject.com/Questions/1250003/How-to-print-gridview-page-in-Csharp[^]

You haven't provided enough information for anyone to help you. What makes you think posting exactly the same thing again will change that?

Use @media rule[^] to define formatting for printer...
 
Share this answer
 
Gridview is just a table when it is rendered on the browser. So basically you just need to print a table.

See examples-
Table Print Only - JavaScript / HTML[^]
Print Table - JSFiddle[^]

And also, look at the CSS Media Queries[^] and check @print rule.


KR
 
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