Showing posts with label html. Show all posts
Showing posts with label html. Show all posts

Friday, August 16, 2013

Page Break in HTML Reporting ASP .NET

  static int ROW_PER_PAGE = 22;// variable for no. of Rows per page
void generatereport()

foreach(DataRow dr in dtbl.Rows)
{
if (k % ROW_PER_PAGE == 0 && k > 0)
 {
                        Response.Write("<tr height=300><td colspan=6 \"text-align:Center; \" valign=\"top\">cont.. </td></tr>");
                        Response.Write("</table>");// end of previous page table
Response.Write("<div \sty\le= 'page-break-after:always'></div>"); //for page Break style ha \ for escape                                                                                                     //sequence get rid of that to use the code
Start New Table and Report Header for new page here
}//end of if

continue with the loop
K++;
}
}

PostBack Full Page Using Control in Update Panel.

If you've ever used an AJAX UpdatePanel and needed to have a control within the UpdatePanel cause a full postback of the page, here's how you do it.

ScriptManager scriptManager = ScriptManager.GetCurrent(Page);

if (scriptManager != null)

{

    scriptManager.RegisterPostBackControl(SaveButton);

}

Progressive rendering via multiple flushes

For HTML Reporting in ASP .net Multiple flushes helps alot in improving user experience.
Each flush generates the chunk of data on display that gives user something to see.
without flush one will have to for the whole page to be rendered but with Progressive rendering the waiting time that frustates user is minimized.
Syntax:
Response.Write("Html code here !");
for(int i=0;i<1000;i++)
{
Response.Flush();//This is what that does all the magic of Progressive Rendering.
.
.
.
.
Response.Write("Your HTM here");

}