Physically printing results (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


sentinel -> Physically printing results (4/18/2008 13:54:13)

Hey all.....

I was asked to create a page that would pull all records for all employee listing within a particular table then print them out individually.

So if my results page looked like this....

Employee One: john Smith

DOB : 02/02/1970

Group: INV

Phone : 555-5555


Employee Two: Jim Shoe

DOB : 02/02/1974

Group: OUTR

Phone : 555-5555


Etc.....


How can I list them on a page so when the user prints them out each record will be on its on sheet of paper?

Any ideas?




rdouglass -> RE: Physically printing results (4/18/2008 14:06:21)

I use a style like so:

<style>
<!--
.newPage
{
page-break-after: always;
}
-->
</style>

and markup like this:

<div class="newPage">
(stuff for the first page here)
</div>
<div class="newPage">
(stuff for the second page here)
</div>
....


Works quite well for me.


EDIT: Oh yeah, you'll probably need to break them out of a single table and put them in their own.




sentinel -> RE: Physically printing results (4/18/2008 14:13:15)

Excellent...

So I can then incorporate them into my database results so the <div class="newPage"> will just continually loop through?

This is great... Thanks!




sentinel -> RE: Physically printing results (5/1/2008 11:13:34)

Rdouglass....

I was trying to use your new page style but am having some difficulty. I created a DRW that simply lists the users in my users table. Instead of getting one user per page i still get them all on it. Can you please take a look at my code and let me know where I am messing up?

<html>
<head>
<title>user test</title>
<style> 
<!-- 
.newPage 
{ 
page-break-after: always; 
} 
--> 
</style> 
</head>

<body>


<!--#include file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<script type="text/javascript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</script>
<% end if %>
<%
fp_sQry="SELECT * from users"
fp_sDefault=""
fp_sNoRecords=""
fp_sDataConn="ncc"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes=""
fp_iDisplayCols=8
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<div class="newPage"> 
<table>
<tr>
<td><%=FP_FieldHTML(fp_rs,"username")%> </td>
<td><%=FP_FieldHTML(fp_rs,"x_Firstname")%> </td>
<td><%=FP_FieldHTML(fp_rs,"x_Lastname")%> </td>
</tr></table>
</div> 
<!--#include file="_fpclass/fpdbrgn2.inc"-->


</body>
</html>



Thanks!




rdouglass -> RE: Physically printing results (5/1/2008 12:12:22)

quote:

Instead of getting one user per page i still get them all on it.


They should display on the screen as on 1 page but they should print on individual pages. Did you try a Print Preview?

I just confirmed the syntax on IE7 and it works for me just fine. I don't see any problems with your code so I'm kinda' at a loss at the moment.

Or are you trying to display them on the screen 1 page at a time?




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.078125