Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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:02am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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 at 14-Dec-12 0:53am
   
thanku its working
__TR__ at 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.
dhritirao1221 at 14-Dec-12 3:51am
   
sorry i didnt observe that.........
__TR__ at 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)



Advertise | Privacy | Mobile
Web04 | 2.8.140926.1 | Last Updated 13 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100