我希望为每个位置添加一行,如下图所示。该行将显示每列的总数。我已经计算了这些值( <%= owetotal %> , <%=paidtotal %>, <%= origtotal %>)只需要将它们放置在正确的位置,我似乎无法按照我想要的方式格式化它.
目前它看起来像这样:
我希望它看起来像这样:
我的 ASPX 页面
<form id="form1" runat="server">
<div class="container">
<div class="page-header">
<h1>
Report</h1>
<br />
<div class="row">
<div class="span11">
<%
System.Data.OleDb.OleDbConnection pcn;
System.Data.OleDb.OleDbCommand pcm;
System.Data.OleDb.OleDbDataReader prs;
pcn = new System.Data.OleDb.OleDbConnection("");
pcm = new System.Data.OleDb.OleDbCommand();
pcn.Open();
pcm.Connection = pcn;
var tableSql = @"SELECT * FROM Accounts";
pcm.CommandText = tableSql;
prs = pcm.ExecuteReader();
var rowcount = 0;
var CurrentLocation = "";
while (prs.Read())
{
rowcount++;
%>
<% if (prs["Location"].ToString() != CurrentLocation)
{ %>
<table width="100%" class="table">
<thead>
<tr>
<th>
Name
</th>
<th>
Owes
</th>
<th>
Paid
</th>
<th>
Original Amt
</th>
<th>
Date
</th>
</tr>
</thead>
<h4>
<%= prs["Location"].ToString()%></h4>
<%
CurrentBranch = prs["Loction"].ToString();
} %>
<tr>
<td>
<%= prs["Name"].ToString() %>
</td>
<td>
$<%= prs["Owes"].ToString() %>
</td>
<td>
$<%= prs["Paid"].ToString() %>
</td>
<td>
$<%= prs["OrigAmt"].ToString() %>
</td>
<td>
<%= Convert.ToDateTime(prs["SubmitDate"].ToString()).ToShortDateString() %>
</td>
</tr>
<%
}
prs.Close();
pcn.Close();
%>
</table>
</div>
</div>
</div>
</div>
</form>