返回首页

谁能帮助?

如何以检索从GridView的价格和数量,它也显示在页脚如何计算在asp.net
totalprice
 0;
 60;

protected void totalprice()

    {

        int quantity = int.Parse("txtquantity");

     float price =float.Parse("price");

     float totalprice = float.Parse("totalPrice");

     totalprice=quantity * price;

}

是THI纠正?

回答

评论会员:S.P.蒂瓦里 时间:2012/02/07
{C} 尝试这个Java脚本。计算Grid元素到页脚assin的总的SP
评论会员:游客 时间:2012/02/07
。蒂瓦里:你可以这样做codeprelang="cs"Protectedspanclass="code-keyword"void/spanTotalprice(){spanclass="code-keyword"foreach/span(GridViewRowgvRowspanclass="code-keyword"in/spanGridViewName.Rows){spanclass="code-keyword"int/spanQuantity=Convert.ToInt32(((TextBox)gvRow.FindControl(spanclass="code-string""/spanspanclass="code-string"txtquantity"/span)).Text)spanclass="code-keyword"int/spanPrice=spanclass="code-keyword"float/span.tryParse(((Label)gvRow.FindControl(spanclass="code-string""/spanspanclass="code-string"lblPrice"/span)).Text)spanclass="code-keyword"float/spanTotalPrice=Quantity*Price; spanclass="code-comment"///spanspanclass="code-comment"findherefooterControlofgridviewandsetthevalue./spanspanclass="code-comment"///spanspanclass="code-comment"firstyouhavetomakesureShowFooterRowistrue/spanlblFooterTotalPrice=(Label)gvrow.FindControl(spanclass="code-string""/spanspanclass="code-string"lblfootertotalPrice"/span);lblFooterTotalPrice.Text=TotalPrice;} }/pre/code的乌玛・尚卡尔帕特尔
让AutoGenerateSelectButton = true时,
GridView的
rowcommand{体C3}