Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

ASP "print button"

Options
  • 26-09-2007 3:39pm
    #1
    Registered Users 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 Posts: 1,466 ✭✭✭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 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 Posts: 39,822 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 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 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