Asp.Net and printing

  • Thread starter Thread starter Chris Dunaway
  • Start date Start date
C

Chris Dunaway

I have a simple .asp page in which is included an IFrame that loads
and Asp.Net page. The asp.net page takes and xml document and uses an
xslt transformation to generate the html for output. The output is
just a viewable only report.

Inside the .aspx page, I have registered a simple client side script
to print the contents of the IFrame like this:

string printScript = @"function PrintIt() { window.print(); }";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(),
"printScript", printScript, true);

In the .xslt, I have placed a standard input tag to serve as the
"Print" button. This works fine for my needs but I had two questions
regarding this method:

1. When the report is printed, the button is visible on the print out
because it is on the page. Is it possible to hide that button when
the iframe is printed?

2. The printed report is essentially a table in which certain cells
have differing background colors and text colors. By default, when
the browser prints, it does not print the background colors, etc. I
can manually turn this on using the settings of the browser, but I was
wondering if there was a way to override the setting from the page
itself?

Thanks,

Chris
 
Back
Top