如何添加标题并对列进行求和?

时间:2011-02-01 11:23:54

标签: c# asp.net

我想给标题DATE,PRICE1,PRICE2,我还在页脚中显示price1,price2的总和。我怎样才能做到这一点?

<asp:Repeater ID="rptCari" runat="server">
                <ItemTemplate>
                    <div>
                        <tr>
                            <td>
                                <asp:Label runat="server" ID="lblBelgeTarihi"><%#(Eval("DATE","{0:d}"))%></asp:Label>
                            </td>
                            <td>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            </td>
                            <td>
                                <asp:Label runat="server" ID="lblAlacakTutar"><%#ValidationHelper.FormatPrice(ValidationHelper.GetDecimal(Eval("PRICE1"), 0))%></asp:Label>
                            </td>
                            <td>
                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                            </td>
                            <td>
                                <asp:Label runat="server" ID="lblBorcTutar"><%#ValidationHelper.FormatPrice(ValidationHelper.GetDecimal(Eval("PRICE2"), 0))%></asp:Label>
                            </td>
                        </tr>
                    </div>
                </ItemTemplate>
            </asp:Repeater>

1 个答案:

答案 0 :(得分:2)

你将HeaderTemplate和FooterTemplate作为Repeater的子元素。