Conditional Validation in DataGrids
-
I have an insert row in the footer of a DataGrid. I need to validate user data on each textbox but only when the "Add Button" is clicked, otherwise empty textboxes will flag a warning preventing the user from even moving between pages. I thought of using a custom validator and checking that the add button was clicked to submit the form, but I'm not sure as to the syntax to follow. Has anyone done any of this before?? b-d:|
-
I have an insert row in the footer of a DataGrid. I need to validate user data on each textbox but only when the "Add Button" is clicked, otherwise empty textboxes will flag a warning preventing the user from even moving between pages. I thought of using a custom validator and checking that the add button was clicked to submit the form, but I'm not sure as to the syntax to follow. Has anyone done any of this before?? b-d:|
You can set other buttons on the form (or any control that causes validation) to not validate. For example: MyButton.CausesValidation = false; By doing so, you can leave your AddButton.CausesValidation to TRUE, and it will be the only control on the page to check for validation. Jon G www.Gizmocoder.com
-
You can set other buttons on the form (or any control that causes validation) to not validate. For example: MyButton.CausesValidation = false; By doing so, you can leave your AddButton.CausesValidation to TRUE, and it will be the only control on the page to check for validation. Jon G www.Gizmocoder.com
Jon G. Thanks for the tip. It was so simple that I'm almost embarrased! I was taking the long road in thinking it through when it was simpler to turn off causesValidation on the navigation buttons and voilá! Regards to you, b-d