473,804 Members | 3,597 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 10299
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******** *************@q 75g2000hsh.goog legroups.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"
<REMOVEALLCAPIT ALSeEgGoldD...@ mMvVpPsS.orgwro te:
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******** *************@q 75g2000hsh.goog legroups.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.goog legroups.com...
On Jun 26, 8:45 am, "Eliyahu Goldin"
<REMOVEALLCAPIT ALSeEgGoldD...@ mMvVpPsS.orgwro te:
>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.goo glegroups.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
2268
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
2861
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 first 3 rows in my Grid due to they are links and I don't need to print the links out?
6
3478
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 and not show the templated fields, (hyperlinks) and also not print those fields?
9
4081
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 so they don't print. Is that possible to do and if so can someone point me somewhere or show my a code snippet on how to do this?
2
2127
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 help me...
1
1324
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 Crystal Report, and I want to print this page without header and footer ( like website address ) and I don't want to view any row "cut" in the printed page :-) ( this occurs when I print in IE). Are there solutions to do this? Thanks. Sam.
1
2593
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 As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click Dim fpr As New frmPrint() With fpr .Title = DataGridView1.CaptionText .ShowDialog() If .Result > 0 Then PrintGrid = New DataGridViewPrint(PrintDocument1, DataGridView1,...
8
2092
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
3004
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 used media css class, I have hidden some fields and assigned the whole div into another page where I show a preview of the page and print from there The problem I face is, Gridview, I do not want Action template columns (Edit,Delete)to be shown in...
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10076
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7616
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4297
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3816
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.