对列值求和并显示在 C# 的页脚中
我有以下代码,用于通过 SQLDATASOURCE 显示 ItemID、名称和价格。 如何获取价格列中值的总和并将其显示在页脚中?
<asp:GridView ID="GridView2" runat="server" ShowFooter="true" AutoGenerateColumns="False" DataKeyNames="ItemID"
DataSourceID="SqlDataSource2" Style="position: relative" >
<Columns>
<asp:BoundField DataField="ItemID" HeaderText="ItemID" InsertVisible="False" ReadOnly="True"
SortExpression="ItemID" />
<asp:BoundField DataField="Name" HeaderText="Name" FooterText="Total" FooterStyle-Font-Bold="true" SortExpression="Name" />
<asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
<ItemTemplate>
</Columns>
</asp:GridView>
非常感谢您的帮助。
谢谢你,
I've the following code which is used to display ItemID, Name, and Price via SQLDATASOURCE. How is it possible to get the SUM of the values in the Price column and display it in the footer?
<asp:GridView ID="GridView2" runat="server" ShowFooter="true" AutoGenerateColumns="False" DataKeyNames="ItemID"
DataSourceID="SqlDataSource2" Style="position: relative" >
<Columns>
<asp:BoundField DataField="ItemID" HeaderText="ItemID" InsertVisible="False" ReadOnly="True"
SortExpression="ItemID" />
<asp:BoundField DataField="Name" HeaderText="Name" FooterText="Total" FooterStyle-Font-Bold="true" SortExpression="Name" />
<asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
<ItemTemplate>
</Columns>
</asp:GridView>
Your help is greatly appeciated.
thank you,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在此处获取更多详细信息: http ://programming.top54u.com/post/ASPNet-20-GridView-Compute-Column-Sum-using-C-sharp.aspx
Get more details here: http://programming.top54u.com/post/ASPNet-20-GridView-Compute-Column-Sum-using-C-sharp.aspx