954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Forcing a page break inside a DIV.

Hey all,

I'm developing a Reports module for an application. anyway, i'm dynamically generating tables and adding them inside an existing DIV which has the following style :

[html]
[/html]

when creating each row inside a loop and add it to the table i check that if the rows number has reached 25, then break the page.

here is how i do it:
C#:

if (rowCount == 25)
{
    tableName.CssClass = "MainTable";
}
else
{
    tableName.CssClass = "MainTableWithoutBreak;
}
 
divName.Controls.Add(tableName);


the CSS Classes:

.MainTable
{
    TABLE-LAYOUT:auto;PADDING-RIGHT:0px;PADDING-LEFT:0px;PADDING-TOP:0px;PADDING-BUTTOM:0px;PAGE-BREAK-AFTER:always;WIDTH:100%
}


the MainTableWithoutBreak CSS class is the same as the MainTable CSS Class but without the PAGE-BREAK-AFTER attribute.

Now the problem is when the report is generated. say that 30 rows are created, the page will have all 30 rows in the same page.

i tried to clear the POSITION: aboslute style from the DIV. then i will have two pages but the first one will start from the middle of the page.

could anyone help me with this problem ? i would really appreciate it.

and sorry if my english is bad and you did not understand anything lol.

khusani
Newbie Poster
13 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

Ar eu showing this Report in IE.. ?

Hey all,

I'm developing a Reports module for an application. anyway, i'm dynamically generating tables and adding them inside an existing DIV which has the following style :

[html]
[/html]

when creating each row inside a loop and add it to the table i check that if the rows number has reached 25, then break the page.

here is how i do it:
C#:

if (rowCount == 25)
{
    tableName.CssClass = "MainTable";
}
else
{
    tableName.CssClass = "MainTableWithoutBreak;
}
 
divName.Controls.Add(tableName);


the CSS Classes:

.MainTable
{
    TABLE-LAYOUT:auto;PADDING-RIGHT:0px;PADDING-LEFT:0px;PADDING-TOP:0px;PADDING-BUTTOM:0px;PAGE-BREAK-AFTER:always;WIDTH:100%
}




the MainTableWithoutBreak CSS class is the same as the MainTable CSS Class but without the PAGE-BREAK-AFTER attribute.

Now the problem is when the report is generated. say that 30 rows are created, the page will have all 30 rows in the same page.

i tried to clear the POSITION: aboslute style from the DIV. then i will have two pages but the first one will start from the middle of the page.

could anyone help me with this problem ? i would really appreciate it.

and sorry if my english is bad and you did not understand anything lol.

sachu
Newbie Poster
2 posts since Nov 2006
Reputation Points: 10
Solved Threads: 0
 

yes i'm using I.E 6. it was working before but suddenly the problem appeared.

khusani
Newbie Poster
13 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

Just remove the Outer Div... What i mean is Dont put the Tables inside the DIV...

Remove the Outer Div a seee.. It should work...

sachu
Newbie Poster
2 posts since Nov 2006
Reputation Points: 10
Solved Threads: 0
 
Just remove the Outer Div... What i mean is Dont put the Tables inside the DIV... Remove the Outer Div a seee.. It should work...



No still it does not work.

khusani
Newbie Poster
13 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You