User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 427,488 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,436 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 4264 | Replies: 4
Reply
Join Date: Oct 2006
Location: Jordan
Posts: 13
Reputation: khusani is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
khusani khusani is offline Offline
Newbie Poster

Help Forcing a page break inside a DIV.

  #1  
Nov 16th, 2006
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#:
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.
Last edited by tgreer : Nov 16th, 2006 at 8:48 am. Reason: No code tags.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2006
Posts: 2
Reputation: sachu is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sachu sachu is offline Offline
Newbie Poster

Re: Forcing a page break inside a DIV.

  #2  
Nov 19th, 2006
Ar eu showing this Report in IE.. ?

Originally Posted by khusani View 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#:
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.
Reply With Quote  
Join Date: Oct 2006
Location: Jordan
Posts: 13
Reputation: khusani is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
khusani khusani is offline Offline
Newbie Poster

Re: Forcing a page break inside a DIV.

  #3  
Nov 19th, 2006
yes i'm using I.E 6. it was working before but suddenly the problem appeared.
Reply With Quote  
Join Date: Nov 2006
Posts: 2
Reputation: sachu is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sachu sachu is offline Offline
Newbie Poster

Re: Forcing a page break inside a DIV.

  #4  
Nov 19th, 2006
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...
Reply With Quote  
Join Date: Oct 2006
Location: Jordan
Posts: 13
Reputation: khusani is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
khusani khusani is offline Offline
Newbie Poster

Re: Forcing a page break inside a DIV.

  #5  
Nov 19th, 2006
Originally Posted by sachu View Post
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 6:58 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC