Sum in text box from data in a gridview

Hi,

I want to take datas (currency) from certains cells in a grid view and make the sum of those datas in a box below.

Example: a grid of 3 columns and 4 rows:
1st column: Date
2nd column : Type (choice between refundable or non-refundable)
3rd column : amount

textbox = sum of every amount refundable in the gridview

Is it possible?

Thanks

Hi Olivier,

You can set a foreach to parse your gridview and get amount where is refundable. See the following code example.

double amount;
double outValue;
foreach(System.Data.DataRow row in FormData.Tables["YOUR_GRIDVIEW"].Rows)
{	
	if(row["YOUR_GRIDVIEW_REFUND"].ToString() == "yes")
	{
		Double.TryParse(row["YOUR_GRIDVIEW_AMOUNT"].ToString(), out outValue)
		amount += outValue;
	}
}

Regards,
Quentin