Repeater的合计如何实现?
<asp:Repeater id="Repeater1" runat="server">
<HeaderTemplate>
<table border="1" width="100%">
<tr bgcolor="#b0c4de">
<th>序号</th>
<th>名称</th>
<th>代码</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="#f0f0f0">
<td>
<%# this.Repeater1.Items.Count + 1%>
</td>
<td><%#Eval("man")%> </td>
<td><%#Eval("monery")%> </td>
</tr>
</ItemTemplate>
<FooterTemplate>
<td>合计</td>
<td>总人数=</td>
<td>总金额=</td>
</table>
</FooterTemplate>
</asp:Repeater>
后台 cs:
public void bindData()
{
SqlConnection con = new SqlConnection("server=.;database=dsc080211_db;uid=sa;password=123");
SqlCommand cmd = new SqlCommand("select * from table ",con);
con.Open();
SqlDataReader sdr = cmd.ExecuteReader();
Repeater1.DataSource = sdr;
Repeater1.DataBind();
sdr.Close();
con.Close();
}
请问这个合计应该怎么实现?
------解决方案--------------------Refer:
http://www.cnblogs.com/insus/archive/2013/03/21/2973326.html
or:
http://www.cnblogs.com/insus/archive/2013/03/22/2974970.html