返回首页

如何解决TGIS在下面的编码错误?
未将对象引用设置到对象的实例。

public void totalprice()

   {

       int quantity;

       float price;

       float rowtotal ;

       float subtotal=0;

       float totalprice ;

       foreach (GridViewRow row in GridView1.Rows)

       {

           //int pro_id = Convert.ToInt32(GridView1.DataKeys[row.RowIndex][0]);

           quantity = Convert.ToInt32((row.FindControl("quantity")).ToString());

           price = float.Parse((row.FindControl("price")).ToString());

           rowtotal = quantity * price;

           subtotal += rowtotal;

       }

 

       totalprice = subtotal;

       lbltprice.Text = totalprice.ToString();

   }

回答

评论会员: 时间:2