Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<Columns>
    <asp:BoundField DataField="OrderNo" HeaderText="OrderNo" />
    <asp:BoundField DataField="Code" HeaderText="Code" />
    <asp:BoundField DataField="Description" HeaderText="Description" />
    <asp:BoundField DataField="Rate" HeaderText="Rate" />
    <asp:TemplateField HeaderText="Qty">
        <ItemTemplate>
            <asp:Label ID="lblqty" runat="server" Text='<%#Eval("Qty") %>' />
        </ItemTemplate>
        <FooterTemplate>
            <asp:Label ID="lbltxttotalprice" runat="server" Text="TotalPrice" />
        </FooterTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Total">
        <ItemTemplate>
            <asp:Label ID="lbltotal" runat="server" Text='<%# Eval("Total") %>' />
        </ItemTemplate>
        <FooterTemplate>
            <asp:TextBox ID="txttotalprice" runat="server" />
        </FooterTemplate>
    </asp:TemplateField>
    <asp:CommandField ShowEditButton="True" />
</Columns>
Posted

1 solution

You need not save the sum of total of all records in your database. You can use SUM[^] to query your table and retrieve the total.

Example:
SQL
SELECT SUM(TotalPrice) AS Total FROM yourTable
 
Share this answer
 
Comments
Dhritirao's 14-Dec-12 0:53am    
thanku its working
__TR__ 14-Dec-12 1:10am    
You're welcome.
Just want to let you know that when you rate an answer 1 you are actually downvoting the answer. If you think the answer was helpful you need to rate it a 4 or 5 and not a 1. In other words 1 is for bad answer and 5 is for a good answer.
Dhritirao's 14-Dec-12 3:51am    
sorry i didnt observe that.........
__TR__ 14-Dec-12 4:14am    
That's ok. This mistake is common with new people visiting this site.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900