How to print from a gridview?

  • Thread starter Thread starter Steve Kershaw
  • Start date Start date
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
 
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
 
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
 
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
 
Back
Top