I have two separate Gridviews with BoundFields where each one of them have their own DataSource, and I need to SUM two of their columns to display a grand total in the ItemTemplateField (lblTotal). This is the .aspx page:

<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>

I'd like to use or calculate the result with JavaScript or jQuery since it might be more efficient. Is this possible? Any suggestions? Thanks a lot for the help!

Related posts

Recent Viewed