Results 1 to 4 of 4

Thread: Javascript+GridView+asp.net

  1. #1

    Thread Starter
    Hyperactive Member Bajrang's Avatar
    Join Date
    Oct 2006
    Posts
    309

    Javascript+GridView+asp.net

    Hi all
    I want to know How can we define no of rows in a window.
    but this script writes all rows of that gridView.
    So How can we control no of rows so we can print as many no of record as we want. Is there any other function Please let me know.
    Your help is highly appreciated, Thanks
    <script language="javascript" type="text/javascript">
    function CallPrint(strid)
    {
    var prtContent = document.getElementById(strid);
    var strOldOne=prtContent.innerHTML;
    var WinPrint = Window.open('','','letf=100,top=100,width=1000,height=1000,toolbar=0,scrollbars=1,status=0,resizable =1');
    WinPrint.document.write(prtContent.outerHTML);
    WinPrint.document.close();
    WinPrint.focus();
    WinPrint.print();
    WinPrint.close();
    }
    </script>
    Using .NET 3.5 (VS 2008) And XP SP2

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Javascript+GridView+asp.net

    You'll have to do some estimation. Get your page to display a long, long datagrid and figure out how many rows you do want displayed. Then, next time, just have your dataset contain x rows, bind the grid to that dataset.

  3. #3

    Thread Starter
    Hyperactive Member Bajrang's Avatar
    Join Date
    Oct 2006
    Posts
    309

    Re: Javascript+GridView+asp.net

    Thanks Mendhak.
    Dataset contain x rows, bind the grid to that dataset
    It will be dependant on GridView's Data.
    Can I not handle this in javascript. Means GridView contains 500 Records but I want to print only 50 to 100 using JAVASCRIPT..
    Means JAVASCRIPT has nothing to do with GridView. Javascript will take data from GridView and will print how many rows we want to print.
    Thanks, Bye
    Using .NET 3.5 (VS 2008) And XP SP2

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Javascript+GridView+asp.net

    You can't. You have to serve this up as part of your HTML and you could potentially 'block' off the rows after #500 using CSS by placing it in another div.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width