Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 27th, 2009, 02:38 PM
Registered User
 
Join Date: Mar 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Implementing a print stylesheet

How do you suggest one implement a print stylesheet? I attached two stylesheets to my masterpage, the main stylesheet and another for printing only, and the print stylesheet is not working quite as well as it does in a straight HTML page; that is, not all formatting and positioning appears to be working. Do you have any suggestions?

Note that I have a button in my masterpage to allow for quick printing. Does it make more sense to create an OnClick button event that prints the page using the desired stylesheet? If so, can you provide some guidance please.
 
Old May 27th, 2009, 03:35 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Can you define "is not working quite as well"? When is it not working? Did you set the media attribute to print?

I usally don't bother with a "Print" button as you don't really need it. Almost all browsers have a Print button right on the main toolbar. As a user, I never use the supplied print button unless I know for sure it does something useful to the page first....

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old May 27th, 2009, 04:53 PM
Registered User
 
Join Date: Mar 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Yes, I have set the media attribute to print. Essentially for the print version I want to get rid of my topmast and left nav bar (display:none), and only display the main content at the left margin of the page (no more float). Pretty typical stuff.

Originally I created my website using straight html and both stylesheets work fine together in IE and Firefox. However, once I moved everything to VWD, I somehow lost the ability to set the margins of the main div to 0 (the other divs aren't showing up, which is good), plus I'm getting a border too, which I thought I'd turned off.

Obviously this is a little hard for you to troubleshoot, so I appreciate your efforts (and it's not a big deal in the end). I suppose I was looking for some caveats re using multiple stylesheets in VWD. You didn't give me any, so there don't appear to be any. Great!

As for the usability of a print button, I'll rethink my strategy. Probably you're correct that it's not necessary. Again, thanks for the great book. I'm a tech writer and I think it's super!!
 
Old May 27th, 2009, 04:59 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

In the end, it all comes down to plain HTML and CSS in the browser, so what works with "plain HTML" should also work with ASP.NET.

Maybe you're having an issue with the client IDs that are changed by the runtime? For example, if you have this:

<div id="SomeDiv" runat="server">....</div>

and this print style sheet:

#SomeDiv
{
display: none;
}

This might break depending on where you use SomeDiv. For example, if you use it in a Master Page, it may end up as:

<div id="ctl00_SomeDiv">.....</div>

which breaks the CSS selector.

HtH,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Stylesheet for print labels aspBegineer83 CSS Cascading Style Sheets 1 January 12th, 2008 01:31 AM
Using Stylesheet on Reports murali.tk BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 April 17th, 2006 09:47 PM
print the hidden page without the print dialog box kayzem Classic ASP Basics 0 April 21st, 2005 11:31 PM
Print and print preview file on the website withou appleLover General .NET 0 February 19th, 2005 02:24 AM
i need help with css stylesheet DSteven CSS Cascading Style Sheets 2 February 13th, 2005 02:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.