本文介绍了总结c#.net中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我想在输入值时总结GrandtotalAmount和GrandTotalQty ...... 以下代码正在执行连接操作... 我想总结.... 请帮助我.. 。 int len = GV_Product.Rows.Count; double tot = 0 。 0 ; int qty = 0 ; for ( int i = 0 ; i < len; i ++) { CheckBox chk =(CheckBox)GV_Product.Rows [i]。 FindControl( chk); 标签lblPrdName =(标签)GV_Product.Rows [i] .FindControl( lblPrdName ); 标签lblPrdPrice =(标签)GV_Product.Rows [i] .FindControl( lblPrdPrice ); TextBox txt_Qty =(TextBox)GV_Product.Rows [i] .FindControl( txt_Qty ); Label lblQty =(Label)GV_Product.FooterRow.FindControl( lblQty); 标签lblTotal =(标签)GV_Product.Rows [i] .FindControl( lblTotal ); 标签lblGrandTot =(标签)GV_Product.FooterRow.FindControl( lblGrandTot); lblTotal.Text = Convert.ToInt32( Convert.ToInt32(txt_Qty.Text) *转换.ToInt32(lblPrdPrice.Text)).ToString(); tot = Convert.ToDouble(tot + lblTotal.Text); qty = Convert.ToInt32(qty + txt_Qty.Text); lblGrandTot.Text = tot.ToString(); lblQty.Text = qty.ToString(); } 解决方案 i want to sumup the GrandtotalAmount and GrandTotalQty...when we entering the values..The below code is doing concatenate operation...I want to sumup....Please Help me...int len = GV_Product.Rows.Count;double tot = 0.0;int qty = 0;for (int i = 0; i < len; i++){ CheckBox chk = (CheckBox)GV_Product.Rows[i].FindControl("chk"); Label lblPrdName = (Label)GV_Product.Rows[i].FindControl("lblPrdName"); Label lblPrdPrice = (Label)GV_Product.Rows[i].FindControl("lblPrdPrice"); TextBox txt_Qty = (TextBox)GV_Product.Rows[i].FindControl("txt_Qty"); Label lblQty = (Label)GV_Product.FooterRow.FindControl("lblQty"); Label lblTotal = (Label)GV_Product.Rows[i].FindControl("lblTotal"); Label lblGrandTot = (Label)GV_Product.FooterRow.FindControl("lblGrandTot"); lblTotal.Text = Convert.ToInt32( Convert.ToInt32(txt_Qty.Text) * Convert.ToInt32(lblPrdPrice.Text) ).ToString(); tot = Convert.ToDouble(tot + lblTotal.Text); qty = Convert.ToInt32(qty + txt_Qty.Text); lblGrandTot.Text = tot.ToString(); lblQty.Text = qty.ToString();} 解决方案 这篇关于总结c#.net中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-30 04:30