VS 2003 Web Application VB.Net
Does anyone know if its possible to print the header row of a datagrid on every page. If so, could you show me how?
LVL 12
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

So you've set up your datagrid to do paging with a page size of 50(or whatever) and you want to display the header when you go to items 51 to 100?
Once you click the next page link on your grid the YourGrid_PageIndexChanged event will get fired. You will set up the new page to display, YourGrid.CurrentPageIndex = e.NewPageIndex and then you'll have to rebuild your data that you are binding to your datatable, and bind it.
Is this what you want to do? Am I understanding the problem?
Donnie4572Author Commented:
Sorry I didn't post enough info.
No one wants paging I must set the datagrid to scroll.

header row = name
item row =    user1
item row =    user2
item row =    user3
item row =    user4
item row =    user5
item row =    user6

So, when this datagrid prints it = about 30 pages. Page one has the header row but page 2-30 only show the item rows.

This datagrid is replacing excel spreadsheet which from file, page setup, sheet tab, rows to be repeated. This allowed them to have the header row added to every page that prints.

Thanks for your help,

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Donnie4572Author Commented:
I think this is the right direction for me. Only the header row still does not print on every page, using this java. (Header Only Prints On First Page) Could you look at the code.. maybe I missed something. I will just paste my page.

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="try1.aspx.vb" Inherits="print1.try1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
            <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
            <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
            <meta name="vs_defaultClientScript" content="JavaScript">
            <meta name="vs_targetSchema" content="">
            <script language="JavaScript">
var gAutoPrint = true; // Flag for whether or not to automatically call the print function

function printSpecial()
     if (document.getElementById != null)
          var html = '<HTML>\n<HEAD>\n';

          if (document.getElementsByTagName != null)
               var headTags = document.getElementsByTagName("head");
               if (headTags.length > 0)
                    html += headTags[0].innerHTML;
          html += '\n</HE>\n<BODY>\n';
          var printReadyElem = document.getElementById("printReady");
          if (printReadyElem != null)
                    html += printReadyElem.innerHTML;
               alert("Could not find the printReady section in the HTML");
          html += '\n</BO>\n</HT>';
          var printWin ="","printSpecial");
          if (gAutoPrint)
          alert("Sorry, the print ready feature is only available in modern browsers.");

      <body MS_POSITIONING="GridLayout">
            <form id="Form1" method="post" runat="server">
                  <input type="button" name="printMe" onClick="printSpecial()" value="Print this Page">
                  <div id="printReady">
                        <asp:DataGrid id=DataGrid1 style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 32px" runat="server" DataSource="<%# ds1 %>" DataKeyField="myID" DataMember="tab1" AutoGenerateColumns="False" Width="550px">
                                    <asp:BoundColumn DataField="numb" SortExpression="numb" HeaderText="numb"></asp:BoundColumn>
                                    <asp:BoundColumn DataField="PoNumb" SortExpression="PoNumb" HeaderText="PoNumb"></asp:BoundColumn>
                                    <asp:BoundColumn DataField="Code" SortExpression="Code" HeaderText="Code"></asp:BoundColumn>
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.