本文介绍了在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
推荐答案
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.
这篇关于在Gridview页脚中显示总计(列值)的总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!