Please Help - Pagebreak after HtmlTable

Dec 5 2005 10:07 PM

Hi,

I need help to print the report page with pagebreak dynamically after every HtmlTable results set.In the following code, I want to put pagebreak inside the loop after  PrintResourceSBT() function.

if(rptData.Tables["WorkGroup"].Rows.Count !=0 )
   { foreach(DataRow drWG in rptData.Tables["WorkGroup"].Rows)
    {   PrintEmptyRow();
     PrintWorkgroup(drWG["WorkGroup"].ToString());
     PrintResourceSBT (workGroupName ,dr["Resource"],dr["ResourceId"],dr["EmployeeId"]);
    }
   }

Function PrintResourceSBT() like

private void PrintResourceSBT(string workGroupName, string resource , string resourceId , string EmployeeId)
  {    HtmlTableRow htr = new HtmlTableRow();
   htr.Cells.Add(ReportUtility.CreateSimpleHtmlCell("StatusHead", "Amount" ,1, "right" , ""));
   htr.Cells.Add(ReportUtility.CreateSimpleHtmlCell("StatusHead", "Hours"   ,1, "right" , ""));
   tblReport.Rows.Add(htr); 
   -----
   ----  }

tblReport is  <TABLE id="tblReport" >

So, when the checkbox btnsave is checked on the report, the following code-behind executes, I've placed this code after PrintResourceSBT()

  btnsave.Attributes.Add("onclick","Javascript:onPageBreak()");

OnPageBreak() function in the .aspx page like
<script language="javascript">
  function onPageBreak()
  {       tblReport.style.pageBreakAfter="always";   }
</script>

And when I run the report its not breaking after every TABLE.... also I want to print the title filter with every page, which is outside of the For loop.. like below..

lblStartDate.InnerText = startDate.ToString("D",currentCulture.DateTimeFormat);
lblEndDate.InnerText   = endDate.ToString("D",currentCulture.DateTimeFormat);

{ foreach(DataRow drWG in rptData.Tables["WorkGroup"].Rows)
    {   PrintEmptyRow();
     -------    }
}

Please help me out....

Thanks