如何在该单元格下方的页脚中显示网格视图的总列 [英] how to show total of a column of a grid view in footer below that cell
问题描述
我有一个网格视图来显示结算信息。 gridview的内容包括
s.no.详情数量perunitprice金额
1 xyz 10 1000 10000
2 abc 5 50 250
总计:1250
这里,金额是通过将数量乘以我在gridview的RowDataBound中完成的perunit价格来计算的。
我想在gridview的页脚中显示总金额,如上所示。为了做到这一点,我使用了模板字段。
这是客户端代码。
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.
<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>
虽然我收到了页脚总数但页脚显示在第6列但我希望它作为第5列的页脚。
我怎么能这样做..任何帮助???
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???
推荐答案
至少你会试过Google一次。请参阅:如何使用bountfields将footertemplate添加到gridview [ ^ ]
Atleast you would have tried Google once. See this : How do i add footertemplate to gridview with bountfields[^]
参见参考.... :)
在asp.net的gridview页脚中显示总列数总和 [ ^ ]
GridView摘要页脚 [ ^ ] < br $> b $ b
在Asp.Net中显示页脚中GridView列值的总和 - C#和Vb.Net [ ^ ]
使用jQuery在ASP.Net GridView中计算行总计和总计 [ ^ ]
display-total-in-gridview-footer [ ^ ]
see references.... :)
Display sum of columns total in gridview footer in asp.net[^]
GridView summary on Footer[^]
Show the Sum of GridView Column Values in Footer in Asp.Net – C# and Vb.Net[^]
Calculate Row Total and Grand Total in ASP.Net GridView using jQuery[^]
display-total-in-gridview-footer[^]
这篇关于如何在该单元格下方的页脚中显示网格视图的总列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!