I am doing validation for gridview on button click.
My requirement is in gridview I can add multiple rows at a time. Suppose if I add 2 rows, In any of 2 rows there should be atleast a column with value PURCHASER then it satisfies my requirement.
But if in both rows there is not PURCHASER then it should prompt alert.
So what I wrote is
for (i = 0; i < GrdPartyInfo.Rows.length; i++) {
if (GrdPartyInfo.Rows[i].Cells[3].Value != "PURCHASER") {
alert('There should be atleast one purchaser');
return false;
}
}
But what happens is, if I add PURCHASER in second row it still prompts me error. WHY ?