Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

ASP "print button"

  • 26-09-2007 03:39PM
    #1
    Registered Users, Registered Users 2 Posts: 868 ✭✭✭


    Hi, I'm an ASP and CSS newbie but I'm getting by.

    I have a page that contains an ASP:table element to display some data.

    Is it feasible to put a button on the page above the table that will print the table only - not the whole page.

    Has anyone any implementation suggestions?

    Thanks folks,
    Brianmc


Comments

  • Registered Users, Registered Users 2 Posts: 1,454 ✭✭✭Smoggy


    you could :

    Store the data you want printed in a div, have a print button that then opens a new window and copies the div into it and call the js window.print();


  • Registered Users, Registered Users 2 Posts: 706 ✭✭✭DJB


    you could use a print.css file to hide all elements on the page accept for the table you want to use. Do a bit of reading on "print css". You embed an extra file for print use only using:

    <link rel="stylesheet" type="text/css" media="print" href="print.css" />

    Read more at:

    http://www.alistapart.com/articles/goingtoprint/

    Rgds, Dave


  • Users Awaiting Email Confirmation Posts: 351 ✭✭ron_darrell


    Would agree with DJ, much easier (and better as users can turn off javascript on their browser but cannot really turn off CSS) to use CSS. Have a look at display:block; and display:none;

    -RD


  • Moderators, Politics Moderators, Paid Member Posts: 44,036 Mod ✭✭✭✭Seth Brundle


    ...users can turn off javascript on their browser but cannot really turn off CSS...
    I have my Firefox web developer toolbar which does this. :p


  • Registered Users, Registered Users 2 Posts: 706 ✭✭✭DJB


    kbannon wrote:
    I have my Firefox web developer toolbar which does this. :p
    Yeah, me too, but how often do you turn off css while browsing? You only really do that during testing... well, I do anyway! :D


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 868 ✭✭✭brianmc


    Thanks folks,

    I used a combination of ideas. I'd made the layout of the site using tables (it's a long time since I've had to do anything webby) so my print button pulls up a new page with a couple of navigation bits and pieces along with the data. The navigation bits are hidden for printing by CSS.

    It worked out well - I like to think.


Advertisement