General discussion

  • Creator
    Topic
  • #2178887

    how to incorporate page-break in asp.net

    Locked

    by mohithmv ·

    Hi All,
    I have n records being retrieved from the DB, bind it to a datagrid control and have set the pagination (10 records per page) attribute of the datagrid control.
    But i want to introduce page breaks after every 20 records, so that whenever i use the javascript “window.print()” the entire set of data needs to be printed with page breaks after every 20 records.

    I have achieved the same using ASP. But not in ASP.net and C#.

    I am using .net 2003, framework 1.1.

    We all know that whenever we use window.print, whatever the user is viewing in the browser will be sent for printing only.

    Kindly let me know if there is any solution for this.

    Regards
    Mohith

All Comments

  • Author
    Replies
    • #3196349

      Reply To: how to incorporate page-break in asp.net

      by tony hopkinson ·

      In reply to how to incorporate page-break in asp.net

      You can twiddle away, but all the user needs to do is change the fontsize and your carefully tweaked layout will go nipples up. You can provide a diffent file for printing though. A doc, PDF etc windows.print will output that instead, it’s one of the meta tags in the page’s header to specify the file with doctype attribute. Course you’ve got to produce that file as well.
      This is the proper way to do it though and it’s far better than relying on the user’s browser set up.

      • #3081884

        Reply To: how to incorporate page-break in asp.net

        by tony hopkinson ·

        In reply to Reply To: how to incorporate page-break in asp.net

        Agreed, but that was what I was saying. In order to guarantee a readbable output you have to be in control. If you rely o0n the clients browser settings for it to ‘fit’, you will be bollixed most of the time. Wther you specify your own settings or a separate document doesn’t matter. crossing your fingers and hoping a straight output of the browser window will do the job is asking for it.

    • #3081513

      Reply To: how to incorporate page-break in asp.net

      by bschaettle ·

      In reply to how to incorporate page-break in asp.net

      Tony, I have to disagree with your comment about a user changing the font size. Granted they can do this on the browser display, but you can control exactly how a page prints using a completely separate style sheet.

      Here’s a slick trick I’ve used: change the visibility of a class between the displayed and printed style sheets. There’s almost no end to the cool stuff you can do by turning entire elements on and off this way.

Viewing 1 reply thread