在Gridview页脚中显示总计(列值)的总和

编程入门 行业动态 更新时间:2024-10-27 12:25:59
本文介绍了在Gridview页脚中显示总计(列值)的总和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

朋友们, 我被困在自己的发展中, 我在Gridview中有一个名为quanity的列,另一个列名为每单位价格, 总计,其中value = quantity * PricePerUnit; 但是我有一个TextChanged Event for Quantity文本框,在上面进行计算并显示在Gridview的总列中. 现在我想要GridviewFooter中(总计)"列的总和.当我在Gridview中的任何行的数量"中输入值时. 需要帮助 问候 Aamir

Hi friends, i am stuck in my development, i have a column named quanity in Gridview and another column name Price per Unit, Total in which value=quantity*PricePerUnit; but i have a TextChanged Event for Quantity textbox on which calculation is done and displayed in total Column of Gridview. now i want the Sum of (Total) Column in GridviewFooter. as i enter the value in Quantity of any row in Gridview. need help regards Aamir

推荐答案

尝试一下. csharpdotnetfreak.blogspot/2009/07/display-total- in-gridview-footer.html [ ^ ] try this. csharpdotnetfreak.blogspot/2009/07/display-total-in-gridview-footer.html[^]

此代码将帮助您:- This code will help you:- int total = 0; protected void girdview_OnRowDataBound(object sender, GridViewRowEventArgs e) { if(e.Row.RowType == DataControlRowType.DataRow) { total += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "Amount_column")); } if(e.Row.RowType == DataControlRowType.Footer) { Label lblAmount = (Label)e.Row.FindControl("amountLabe"); lblAmount.Text = total.ToString(); } }

祝你好运.

Good luck.

www.dotnetfunda/forums/thread7788-gridview-contol-for-footer-template.aspx [ ^ ] www.telerik. com/community/code-library/aspnet-ajax/grid/calculated-column-with-total-in-footer.aspx [ ^ ] www.dotnetfunda/forums/thread7788-gridview-contol-for-footer-template.aspx[^] www.telerik/community/code-library/aspnet-ajax/grid/calculated-column-with-total-in-footer.aspx[^]

更多推荐

在Gridview页脚中显示总计(列值)的总和

本文发布于:2023-11-22 04:17:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1615947.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:总和   Gridview   页脚中

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!