473,387 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to print from a gridview?

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

Jun 26 '07 #1
3 10273
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
"Steve Kershaw" <st***********@yahoo.comwrote in message
news:11*********************@q75g2000hsh.googlegro ups.com...
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

Jun 26 '07 #2
On Jun 26, 8:45 am, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
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

"Steve Kershaw" <steve_kers...@yahoo.comwrote in message

news:11*********************@q75g2000hsh.googlegro ups.com...
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- 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

Jun 26 '07 #3
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" <st***********@yahoo.comwrote in message
news:11**********************@n2g2000hse.googlegro ups.com...
On Jun 26, 8:45 am, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
>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

"Steve Kershaw" <steve_kers...@yahoo.comwrote in message

news:11*********************@q75g2000hsh.googlegr oups.com...
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- 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

Jun 26 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: DXJas | last post by:
If I have a gridview control in a web page and it has multiple pages of records. How do I allow the user to print the multiple pages? -- Jas
4
by: CSharpguy | last post by:
My web app is using master pages, On the content page I'm using a GridView. I need to print my GridView and I need to exclude the HyperLink columns. How can I print my content page and exclude the...
6
by: CSharpguy | last post by:
In my gridview I have 2 -3 template fields which are hyperlinks. I allow the user to print this grid. When the grid prints it also prints the links, how can I take the user to a print preview page...
9
by: igotyourdotnet | last post by:
I need to create a print preview page BUT my page I need to print has a grid and in the grid I have 2 or 3 columns that have links I want to hide the columns with the links on my print preview page...
2
by: hdotnetdev | last post by:
in my page i have gridview control i can print the header of gridview every page but the first page only having top border but i need top border in all page or print header with color . can anyone...
1
by: Sam | last post by:
Hi, I have to print an aspx page. The page contains only a gridView ( with many rows). The gridView consist of two template fields where I have put in another gridView inside. I don't know...
1
OuTCasT
by: OuTCasT | last post by:
Can some one please tell me if this is the correct way to print data from a gridview because it gives me an error Private PrintGrid As DataGridViewPrint Private Sub btnPrint_Click(ByVal sender...
8
by: =?Utf-8?B?THVpZ2k=?= | last post by:
Hi all, anyone knows if is it possible to insert (and obviously save) a Windows print screen in a GridView cell? (ASP.NET 2.0). Thanks in advance. -- Luigi
6
by: beulajo | last post by:
I have a webpage which has grid entry with paging, and all the other asp controls, I need to print this page for the user with the print preview option. What I have done right now is I have...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.