repeater advice

M

Matt Mercer

Hi,

I have an ASP .NET /VB application over a SQL database. I am designing
a print friendly page. The database holds security incidents with the
possibility of multiple (or none) people, and property attached to the
incident. There is an incident table, person table, and property table
all tied together by the incident number. When someone hits the print
button I open a new page and use 3 datarepeaters to display the data.
What happens is this:

For example, If I have more than one person tied to an incident, the
repeater goes through one time and displays my data perfectly the way
I have laid the table out. The second person appears all jumbled with
no formatting though. Here is an example:

Person
Name: matt Involvement: Contact Status: Contractor

Employer: motorola Employee ID: 0987654321
Employer Address: 1000 west Employer Phone #: 0987654321
Department: ep809 Supervisor: george Shift: first

Home Address: 2000 east Home Phone: 0987654321 Pager: 0987654321

Notes: more notes
Name:george Involvement:Reported By Status:Other Employer:motorola
Employee ID:1234 Employer Address:8000 west sunrise Employer Phone
#:1234567890 Department:et555 Supervisor:me Shift:first Home
Address:7000 west university Home Phone:1234567890 Pager:1234567890
Notes:my notes

****Hard to see with copy and paste but you should get the picture
that the first person has some formatting while the second is just
fields of data crammed together. I am using a select statement and a
repeater bound to a datareader. Here is the repeater code. Any help is
appreciated. Thanks.

<asp:Repeater id="rptPrintFriendlyPerson" runat="server">
<HeaderTemplate>
<table width="100%">
<tr align="center" bgcolor="#0000FF"><td colspan="6" >
<font color="#FFFFFF">Person</font>
</td></tr>
</HeaderTemplate>
<itemtemplate>

<tr>
<td><b>Name:</b></td><td><%# Container.DataItem("person_name")
%></td>
<td><b>Involvement:</b></td><td><%#
Container.DataItem("involvement") %></td>
<td><b>Status:</b></td><td><%# Container.DataItem("person_status")
%></td>
</tr>

<tr><td>&nbsp;</td></tr>

<tr>
<td><b>Employer:</b></td><td><%# Container.DataItem("employer")
%></td>
<td><b>Employee ID:</b></td><td><%#
Container.DataItem("employee_id") %></td>
</tr>

<tr>
<td><b>Employer Address:</b></td><td><%#
Container.DataItem("employer_address") %></td>
<td><b>Employer Phone #:</b></td><td><%#
Container.DataItem("employer_phone") %></td>
</tr>

<tr>
<td><b>Department:</b></td><td><%# Container.DataItem("department")
%></td>
<td><b>Supervisor:</b></td><td><%# Container.DataItem("supervisor")
%></td>
<td><b>Shift:</b></td><td><%# Container.DataItem("shift") %></td>
</tr>

<tr><td>&nbsp;</td></tr>

<tr>
<td><b>Home Address:</b></td><td><%#
Container.DataItem("home_address") %></td>
<td><b>Home Phone:</b></td><td><%# Container.DataItem("home_phone")
%></td>
<td><b>Pager:</b></td><td><%# Container.DataItem("pager") %></td>
</tr>

<tr><td>&nbsp;</td></tr>

<tr>
<td><b>Notes:</b></td><td><%# Container.DataItem("person_notes")
%></td>
</tr>
</table>
</itemtemplate>
</asp:repeater>
 
K

Karl Seguin

Matt,
there appears tobe some pretty basic HTML errors.

For example,
your first row has 6 columns, your 2nd one has 1 and your 3rd has 4...you'll
need to throw in some colspans.

Also, you open your <Table> in the headertemplate (happens once) and you
close it in your itemtemplate (happens once per row). so you'll end up with.
<table>
<tr><td>ur stuff here</td></tr>
</table>
<tr><td>ur stuff here</td></tr>
</table>
<tr><td>ur stuff here</td></tr>
</table>
<tr><td>ur stuff here</td></tr>
</table>
<tr><td>ur stuff here</td></tr>
</table>



your </table> must be placed in the FooterTemplate or your <table> in the
itemtemplate..


Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top