Thursday, 17 September 2009

Validation groups in my add/edit ListView

A schoolboy error this one - I created a ListView and made the InsertItemPosition the footer row, enabled editing, and everything was working great. Then I added some requiredfieldvalidators to my edit and insert fields. Then there was a problem, I couldn't make an edit without the validator triggering on the insert fields, despite the input fields being named differently and the validators assigned accordingly. And then I remembered the ValidationGroup attribute, which by default doesn't appear in your validator.

To link a validator to an action, simply assign the same ValidationGroup attribute to the button and the validator.

No comments:

Post a Comment

Comments are moderated, so you'll have to wait a little bit before they appear!