How to print from a gridview?

S

Steve Kershaw

Hi,

I need to print the contents (rows and columns) of a GridView to the
default printer.
Is there any way of doing this easly?

Thanks

Steve
 
E

Eliyahu Goldin

Depends on how you define "easily".

Printing is initiated by a javascript call window.print(). You have 2
javascript events onbeforeprint and onafterprint that allow you to set up
the page for printing by hiding what you don't want to print. You can also
make use of printing support in CSS. Google for something like "printing
css" and you will find plenty of info.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
S

Steve Kershaw

Depends on how you define "easily".

Printing is initiated by a javascript call window.print(). You have 2
javascript events onbeforeprint and onafterprint that allow you to set up
the page for printing by hiding what you don't want to print. You can also
make use of printing support in CSS. Google for something like "printing
css" and you will find plenty of info.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net




I need to print the contents (rows and columns) of a GridView to the
default printer.
Is there any way of doing this easly?

Steve- Hide quoted text -

- Show quoted text -

I need to print the GridView data (row and columns) only, not the
entire ASP.Net web page. Further, I need to print the entire contents
of the GridView not just the displayed portion.

Thanks
Steve
 
E

Eliyahu Goldin

Hiding parts of the page is not a problem. You can do it either with the
javascript events or with CSS, as I wrote.

Printing the entire content is a problem since printing is performed on
client side and the client has only the displayed part of the grid. What you
can do is to make a separate printer-friendly form where you will render the
entire grid.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Steve Kershaw said:
Depends on how you define "easily".

Printing is initiated by a javascript call window.print(). You have 2
javascript events onbeforeprint and onafterprint that allow you to set up
the page for printing by hiding what you don't want to print. You can
also
make use of printing support in CSS. Google for something like "printing
css" and you will find plenty of info.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP
[ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net




I need to print the contents (rows and columns) of a GridView to the
default printer.
Is there any way of doing this easly?

Steve- Hide quoted text -

- Show quoted text -

I need to print the GridView data (row and columns) only, not the
entire ASP.Net web page. Further, I need to print the entire contents
of the GridView not just the displayed portion.

Thanks
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top