Can CompareValidator be used to compare cells in a gridview?

  • Thread starter Thread starter bogdan
  • Start date Start date
B

bogdan

Is it possible to have a CompareValidator to compare values from two cells
in a gridview row? I'd like to do that while in edit mode.
Thanks,
Bogdan
 
You'd need to have controls such as TextBoxes in the <EditItemTemplate> with
explicit ID as you need to assign the IDs to the validator so that it knows
which controls to compare/validate. And the validator must also exist in the
template, otherwise it cannot "see" the validated controls as they'd be in
different naming container. But that way it basically is possible.
 
Thanks for the reply.

Do the controls to be validated have to be within the same
<EditItemTemplate>? If yes, then this would mean that they would have to
belong to the same gridview column, correct? So, I can't really have a
comparevalidator to span columns, can I?

Thanks,
Bogdan
 
Back
Top