用gridview属性Rows.Count取值 比如
for (int i = 0; i < gvdata.Rows.Count; i++)
{
addxipurchbilling.Goods_id = Convert.ToInt32(gvdata.Rows[i].Cells[0].Text.ToString());
addxipurchbilling.Goods_name = gvdata.Rows[i].Cells[1].Text.ToString();
addxipurchbilling.Specifications = gvdata.Rows[i].Cells[2].Text.ToString();
addxipurchbilling.Units_of_measurement = gvdata.Rows[i].Cells[3].Text.ToString();
addxipurchbilling.PurchBilling_number = Convert.ToInt32(gvdata.Rows[i].Cells[4].Text.ToString());
addxipurchbilling.PurchBilling_unitprice = Convert.ToDecimal(gvdata.Rows[i].Cells[5].Text.ToString());
addxipurchbilling.PurchBilling_price = Convert.ToDecimal(gvdata.Rows[i].Cells[6].Text.ToString());
addxipurchbilling.Goods_barcode = gvdata.Rows[i].Cells[7].Text.ToString();
}