views:

12

answers:

1

Hello,

Does anyone know how to make CustomValidator work with controls which are in DetailsView for example ahen updating item

CustomValidator doesnt work on controls which are in detailsView after performin for example update on that detailsView. For example RequiredFiledValidator works with no problem while CustomValidator has problems (Validation doesnt occur):/

A: 

The problem is that the update link in the DetailsView does not trigger validation controls in the postback since a Button, ImageButton or LinkButton is required for this to happen. Client-side validators that are using javascript will work though which is pretty confusing.

The solution is to convert your DetailsView:s CommandField to a TemplateField: 'Edit Fields' -> Select the Command Field -> click 'Convert this field into a TemplateField'.

You can see a discussion about this here: http://forums.asp.net/t/1102008.aspx?PageIndex

Andreas Paulsson