Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a grid view to display the billing information. The content of gridview includes

s.no. particulars quantity perunitprice amount
1 xyz 10 1000 10000
2 abc 5 50 250
Total: 1250

here, amount is calculated by multiplying quantity with perunit price which i have done in RowDataBound of gridview.
I wanted to display total amount in footer of gridview as shown above. In order to do so, i have used template field.
Here is the client side code.

ASP.NET
<Columns>
    <asp:TemplateField HeaderText="S. No">
        <ItemTemplate>
        <%# Container.DataItemIndex + 1 %>
        </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="particulars" HeaderText="particulars" />
                            <asp:BoundField DataField="Quantity" HeaderText="Quantity" />
                            <asp:BoundField DataField="Per_Unit_Price" HeaderText="Per Unit Price" />
                            <asp:BoundField DataField="Amount" HeaderText="Amount" />
                            <asp:TemplateField>
                                <FooterTemplate>
                                    <asp:Label ID="lblTotal" runat="server"></asp:Label>
                                </FooterTemplate>
                            </asp:TemplateField>
                        </Columns>


Although i am getting total in footer but the footer is displayed in 6th column but i wanted it as a footer of 5th column.
How can i do it.. any help???
Posted
Updated 10-Jun-14 21:43pm
v2

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