try this code:
public void totalprice()
{
float pricee;
int quantityy;
float totalprice;
foreach (GridViewRow row in GridView1.Rows)
{
int pro_id = Convert.ToInt32(GridView1.DataKeys[row.RowIndex][0]);
pricee = dal.getprice(pro_id);
quantityy = dal.getquantity(pro_id);
totalprice += quantityy * pricee;
}
lbltprice.Text = totalprice.ToString();
}
hope it helps!
don't forget to vote :)