ASP.NET 2.0 - how to assign the print command to a button

Posted on 2007-07-24
Last Modified: 2013-11-26
I have created a webform in 2.0. The user inputs the data to the first page and then clicks on a button named 'continue'. The iput data is passed to the results page and there's a button named 'print' on the results page. When the user clicks on the print button i want the page to be printed. How do i do this?
Question by:sergeiweerasuriya
    LVL 12

    Accepted Solution

    you can do it with javascript


    please go through link

    LVL 9

    Assisted Solution

    Its actually a one liner - btnprint.Attributes.Add("onclick", "window.print();return false;");
    add this in the page load .
    LVL 14

    Expert Comment

    I do it this way. In fact its pretty much same.
     btnPdf.Attributes.Add("onclick", "javascript:window.print();");
    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now