Tuesday, 13 August 2013

Link DataGrid and DetailsView validations to Button control

Before release 4.1.2311.5146,  data in DetailsView and DataGrid controls are only validated when used with the 'Save and Cancel' buttons. That means, users would have to write custom validations if they wish to use a Button control. Now, you can link standalone buttons to DataGrid and DetailsView validations using the 'ApplyValidationsButton' property. Here's how it works:

1. Create an editable DataGrid.
2. Create a Validation. In this example, I am adding a Required Field Validator.
3. Select the Validation in the DataGrid column.

4. Add a button. Select the button in the 'ApplyValidationsButton' property. This links the button to the DataGrid validation.


Results :
1. The actions on the button will not be executed if any of the validations fail.


Tips :
** This feature also works for Required Field validation in DetailsView dropdown.

1 comment:

  1. […] Stadium3 « Exporting Reports with Report Viewer 2012 Link DataGrid and DetailsView validations to Button control […]

    ReplyDelete