944,081 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 8458
  • ASP.NET RSS
Nov 16th, 2006
0

Forcing a page break inside a DIV.

Expand Post »
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]<DIV id="forPrint" class="hide" style="PADDING-RIGHT:0px;PADDING-LEFT:0px;LEFT:0px;PADDING-BOTTOM:0px;WIDTH:100%;PADDING-TOP:0px;POSITION;absolute;TOP:0px;HEIGHT:100%" runat=server>
</DIV>[/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#:
ASP.NET Syntax (Toggle Plain Text)
  1. if (rowCount == 25)
  2. {
  3. tableName.CssClass = "MainTable";
  4. }
  5. else
  6. {
  7. tableName.CssClass = "MainTableWithoutBreak;
  8. }
  9.  
  10. divName.Controls.Add(tableName);
  11.  

the CSS Classes:
ASP.NET Syntax (Toggle Plain Text)
  1. .MainTable
  2. {
  3. TABLE-LAYOUT:auto;PADDING-RIGHT:0px;PADDING-LEFT:0px;PADDING-TOP:0px;PADDING-BUTTOM:0px;PAGE-BREAK-AFTER:always;WIDTH:100%
  4. }



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.
Last edited by tgreer; Nov 16th, 2006 at 9:48 am. Reason: No code tags.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
khusani is offline Offline
13 posts
since Oct 2006
Nov 19th, 2006
0

Re: Forcing a page break inside a DIV.

Ar eu showing this Report in IE.. ?

Click to Expand / Collapse  Quote originally posted by khusani ...
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]<DIV id="forPrint" class="hide" style="PADDING-RIGHT:0px;PADDING-LEFT:0px;LEFT:0px;PADDING-BOTTOM:0px;WIDTH:100%;PADDING-TOP:0px;POSITION;absolute;TOP:0px;HEIGHT:100%" runat=server>
</DIV>[/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#:
ASP.NET Syntax (Toggle Plain Text)
  1. if (rowCount == 25)
  2. {
  3. tableName.CssClass = "MainTable";
  4. }
  5. else
  6. {
  7. tableName.CssClass = "MainTableWithoutBreak;
  8. }
  9.  
  10. divName.Controls.Add(tableName);
  11.  

the CSS Classes:
ASP.NET Syntax (Toggle Plain Text)
  1. .MainTable
  2. {
  3. TABLE-LAYOUT:auto;PADDING-RIGHT:0px;PADDING-LEFT:0px;PADDING-TOP:0px;PADDING-BUTTOM:0px;PAGE-BREAK-AFTER:always;WIDTH:100%
  4. }



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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sachu is offline Offline
2 posts
since Nov 2006
Nov 19th, 2006
0

Re: Forcing a page break inside a DIV.

yes i'm using I.E 6. it was working before but suddenly the problem appeared.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
khusani is offline Offline
13 posts
since Oct 2006
Nov 19th, 2006
0

Re: Forcing a page break inside a DIV.

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...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sachu is offline Offline
2 posts
since Nov 2006
Nov 19th, 2006
0

Re: Forcing a page break inside a DIV.

Click to Expand / Collapse  Quote originally posted by sachu ...
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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
khusani is offline Offline
13 posts
since Oct 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Frames in .NET
Next Thread in ASP.NET Forum Timeline: Maintaining Sessions





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC