I have interactive grid and I need to calculate low limit and high limit depends on values of mean and SD and this is the equation
low = (mean - sd) * 2
high = (mean + sd) * 2
this is the example see image :
I need when click the button calculate low limit and high limit execute the calculations
I have old C sharp program and I did the loop and calculation when button pressed and this is the C sharp code :
private void btnsdi_Click(object sender, EventArgs e)
{
for (int i = 0; i < dgvResult.Rows.Count; i++)
{
if (!String.IsNullOrEmpty(dgvResult.Rows[i].Cells[4].Value.ToString()) && !String.IsNullOrEmpty(dgvResult.Rows[i].Cells[5].Value.ToString()))
{
string mean = dgvResult.Rows[i].Cells[4].Value.ToString();
string sd = dgvResult.Rows[i].Cells[5].Value.ToString();
dgvResult.Rows[i].Cells[6].Value = (Convert.ToDecimal(mean) - (Convert.ToDecimal(sd) * 2));
dgvResult.Rows[i].Cells[7].Value = (+Convert.ToDecimal(mean) +(Convert.ToDecimal(sd) * 2));
}
}
}
How can I loop and do the calculation when click the button in interactive grid or if I can do it for each row when enter mean and SD do calculation by the row ?
Without having tested, this is what I would do: Create a dynamic action on change of mean, sd that calculates the low and another one that calculates the high. Set action to fire on page load. This will ensure that the value is always up to date (on page load and on change) and there is no button needed.