Click here to Skip to main content
Sign Up to vote bad
good
See more: ASP.NET
<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 13 Dec '12 - 1:02


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:
SELECT SUM(TotalPrice) AS Total FROM yourTable
  Permalink  
Comments
dhritirao1221 - 14 Dec '12 - 0:53
thanku its working
__TR__ - 14 Dec '12 - 1:10
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.
dhritirao1221 - 14 Dec '12 - 3:51
sorry i didnt observe that.........
__TR__ - 14 Dec '12 - 4:14
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)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Ron Beyer 220
1 OriginalGriff 203
2 Mahesh Bailwal 190
3 Aarti Meswania 185
4 Rohan Leuva 180
0 Sergey Alexandrovich Kryukov 8,548
1 OriginalGriff 6,819
2 CPallini 3,648
3 Rohan Leuva 2,933
4 Maciej Los 2,288


Advertise | Privacy | Mobile
Web01 | 2.6.130516.1 | Last Updated 13 Dec 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid