Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. GridView printing problems

GridView printing problems

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptcssquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bajrang Singh
    wrote on last edited by
    #1

    Hi All, I am facing GridView printing problems those are: 1. How can I get Formatted Contents of a grid using JAVASCRIPT. function CallPrint(strid) { var prtContent = document.getElementById(strid); var strOldOne=prtContent.innerHTML; var WinPrint = window.open('','','letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0'); WinPrint.document.write(prtContent.innerHTML); WinPrint.document.close(); WinPrint.focus(); WinPrint.print(); WinPrint.close(); prtContent.innerHTML=strOldOne; } Rightnow it displays all rows of gridview in one row I tried outerHTML but this displays same GridView as it is in ASPX page. I want text format only with some formating so It can be readable and can be printed. 2. How can I print all rows of multiple page GridView, currently It is printing only the current page of GridView. Many Thanks

    Bajrang Singh Using .net 2.0 (VS2005)

    T 1 Reply Last reply
    0
    • B Bajrang Singh

      Hi All, I am facing GridView printing problems those are: 1. How can I get Formatted Contents of a grid using JAVASCRIPT. function CallPrint(strid) { var prtContent = document.getElementById(strid); var strOldOne=prtContent.innerHTML; var WinPrint = window.open('','','letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0'); WinPrint.document.write(prtContent.innerHTML); WinPrint.document.close(); WinPrint.focus(); WinPrint.print(); WinPrint.close(); prtContent.innerHTML=strOldOne; } Rightnow it displays all rows of gridview in one row I tried outerHTML but this displays same GridView as it is in ASPX page. I want text format only with some formating so It can be readable and can be printed. 2. How can I print all rows of multiple page GridView, currently It is printing only the current page of GridView. Many Thanks

      Bajrang Singh Using .net 2.0 (VS2005)

      T Offline
      T Offline
      ToddHileHoffer
      wrote on last edited by
      #2

      Your making this tougher then it is. I would not try to print one section of a page via javascript. Just create a new page with only the content that you wish to print. For example if you want to print only a gridview copy and paste your grivdview into a new aspx page. On page load (re-load the grid) and then print. Good luck.

      I didn't get any requirements for the signature

      B 1 Reply Last reply
      0
      • T ToddHileHoffer

        Your making this tougher then it is. I would not try to print one section of a page via javascript. Just create a new page with only the content that you wish to print. For example if you want to print only a gridview copy and paste your grivdview into a new aspx page. On page load (re-load the grid) and then print. Good luck.

        I didn't get any requirements for the signature

        B Offline
        B Offline
        Bajrang Singh
        wrote on last edited by
        #3

        Thanks ToddHileHoffer for suggestion. Is using javascript for a new window that contains that gridView not a good idea instead a new aspx page that contains printable contents(gridview). I got almost I wanted to do except one thing that is, if GridView has multiple pages how can I print all pages using a single click. Right now I have to visit every page of that Grid View and then print. If u have any better and simple idea that can print all pages of GridView, please post me. I will be highly thank full to u. Bye

        Bajrang Singh Using .net 2.0 (VS2005)

        T 1 Reply Last reply
        0
        • B Bajrang Singh

          Thanks ToddHileHoffer for suggestion. Is using javascript for a new window that contains that gridView not a good idea instead a new aspx page that contains printable contents(gridview). I got almost I wanted to do except one thing that is, if GridView has multiple pages how can I print all pages using a single click. Right now I have to visit every page of that Grid View and then print. If u have any better and simple idea that can print all pages of GridView, please post me. I will be highly thank full to u. Bye

          Bajrang Singh Using .net 2.0 (VS2005)

          T Offline
          T Offline
          ToddHileHoffer
          wrote on last edited by
          #4

          Turn paging off on your print page. That will lead to the problem of page breaks. You could add a counter in the itemDatabound event in the grid (along with a template column) you could add a page break via .css every 15 records or so. http://www.htmlgoodies.com/beyond/css/article.php/3470341 Although I've never tried that.

          I didn't get any requirements for the signature

          B 1 Reply Last reply
          0
          • T ToddHileHoffer

            Turn paging off on your print page. That will lead to the problem of page breaks. You could add a counter in the itemDatabound event in the grid (along with a template column) you could add a page break via .css every 15 records or so. http://www.htmlgoodies.com/beyond/css/article.php/3470341 Although I've never tried that.

            I didn't get any requirements for the signature

            B Offline
            B Offline
            Bajrang Singh
            wrote on last edited by
            #5

            Thanks ToddHileHoffer for suggestions. I am using BoundFields not the template column, So please tell me how can I insert a page break after each 15 records using BoundFields. Thanks Again. Bye -- modified at 4:18 Wednesday 4th July, 2007

            Bajrang Singh Using .net 2.0 (VS2005)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups