在Gridview页脚中显示总计(列值)的总和 [英] To show the Sum of Total(Column Value) in Gridview Footer

查看:77
本文介绍了在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

推荐答案

尝试一下.

http://csharpdotnetfreak.blogspot.com/2009/07/display-total- in-gridview-footer.html [ ^ ]
try this.

http://csharpdotnetfreak.blogspot.com/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.


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

http://www.telerik.com/community/code-library/aspnet-ajax/grid/calculated-column-with-total-in-footer.aspx[^]


这篇关于在Gridview页脚中显示总计(列值)的总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆