我有两个单独的Gridview与BoundFields,其中每个都有自己的DataSource,我需要SUM两个列来显示ItemTemplateField(lblTotal)中的总计。这是.aspx页面:
<asp:GridView ID="GridView1" runat="server" CssClass="Gridview" AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
<AlternatingRowStyle BackColor="#e9f0f9"/>
<Columns>
<asp:BoundField DataField="Total_Charges" ItemStyle-CssClass="charges" HeaderText="TOTAL CHARGES" />
<asp:TemplateField HeaderText = "BALANCE">
<ItemTemplate>
<asp:Label ID="lblTotal" runat="server" Text="0" Font-Bold="True" ForeColor="#CC0000"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:GridView ID="GridView2" runat="server" CssClass="Gridview" AutoGenerateColumns="False" DataSourceID="SqlDataSource2">
<AlternatingRowStyle BackColor="#e9f0f9"/>
<Columns>
<asp:BoundField DataField="TOTAL_CREDITS" ItemStyle-CssClass="credits" HeaderText="TOTAL CREDITS" />
</Columns>
</asp:GridView>
我想用JavaScript或jQuery来使用或计算结果,因为它可能更有效率。这可能吗?有什么建议?非常感谢您的帮助!