Implementing print functionality in ASP.NET web application

G

Guest

Hi there!

I'm a total newbie at web development, so I started bydownloading and
installing Visual Web Developer 2005 Express Edition as well as SQL Server
2005 Express Edition. I also downloaded several starterkits and studied the
MSDN articles on these starterkits. I learned quite a lot from them and got
things started nicely. There is one thing that I hoped to find, however, but
didn't. That is how to implement printing in my web application. Just
printing the web page itself is one thing, but I'd also like to enable my
users to print reports, preferably in some sort of company housestyle.

I already looked into the options of the ReportViewer object, which seem to
cover what I need for my application. However, when I include the object in
my web page, the Print button doesn't show, so for some weird reason that
doesn't work. Maybe I'm doing something wrong.

Are there any whitepapers or other technical articles that can help me get
what I want? Or can anyone provide me with an example (ASP.NET/C#) that I can
use?

Any help will be greatly appreciated!!

Greetings, Vera
 
M

Mark Fitzpatrick

Vera,
There's a ShowPrintButton property that can be set to true/false.
Now, because it's a web app, you really don't have the same control over
printing that you would with a desktop app. HTML and Javascritp only enable
so much with printing as the basic design of a web browser precludes this
kind of access (security hazard and all). You could control certain aspects
using CSS as most modern browsers support the ability to define a special
print set of styles that define the appearance of the document when it's
printed out, but doesn't show it when it's being viewed in the browser.
 
J

Jon Paal

Hi there!

I'm a total newbie at web development, so I started bydownloading and
installing Visual Web Developer 2005 Express Edition as well as SQL Server
2005 Express Edition. I also downloaded several starterkits and studied the
MSDN articles on these starterkits. I learned quite a lot from them and got
things started nicely. There is one thing that I hoped to find, however, but
didn't. That is how to implement printing in my web application. Just
printing the web page itself is one thing, but I'd also like to enable my
users to print reports, preferably in some sort of company housestyle.

I already looked into the options of the ReportViewer object, which seem to
cover what I need for my application. However, when I include the object in
my web page, the Print button doesn't show, so for some weird reason that
doesn't work. Maybe I'm doing something wrong.

Are there any whitepapers or other technical articles that can help me get
what I want? Or can anyone provide me with an example (ASP.NET/C#) that I can
use?

Any help will be greatly appreciated!!

Greetings, Vera
 
G

Guest

I tried the ShowPrintButton property. Even if I set it to true, the button
doesn't show.

There must be some way to get some printing done from a web page. Even this
page from which I entered my question has a button saying 'Print Post'. So
it's obviously not impossible. But how does it work? What objects and/or
classes do I need and how do I use them? And you say something about CSS. How
do I use that? Do you have an example?

Vera
 
M

Mark Fitzpatrick

Vera,
No object or class will do it. The Print Post button I believe
you're seeing (I don't see it as I'm accessing the group through a
newsreader directly and not a web interface) will only use a JavaScript on
the client to invoke the print dialog. There's not much else that is or can
be done as you can't create server-side print code because that won't affect
the browser, and the browser is designed to prevent any malicious code from
running features of the OS.

Run a search over at www.dynamicdrive.com for some JavaScript print
functions. There are a few, but all they can really do is invoke the print
dialog. There's one implementation at:
http://www.dynamicdrive.com/dynamicindex9/other1.htm A little more complex
than some, but supposedly cross-browser compatible.
 

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
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top