Hi there,
I need to do validation, verifying that at least one of several CheckBox controls are checked. Normally I would do with with the ASP.NET CustomValidator. What is the recommended for doing this with DevExpress?
Thanks,
Andrew
How to implement custom validation of DevExpress ASP.NET editors
Answers
Hello Andrew,
Thank you for your clarification.
I believe you can utilize the ASPxValidationSummary to display a validation message at any place on a page. Please refer to the Validation - Validation Summary demo for an example.
If it does not meet your requirements, would you demonstrate your scenario to us and we'll try to find a corresponding solution.
Best regards,
Vladimir
Here is an example of probably what he is talking about:
ASPx<asp:CustomValidator runat="server" Enabled="true" ID="cvSelections" Display="Dynamic"
ErrorMessage="My Error message" SetFocusOnError="True" ForeColor="Red" Font-Bold="true"
OnServerValidate="cvSelections_ServerValidate" />
This obviously isn't bound to an UI control. It is just some validation.
Do I need to start hacking? eg create a 0px wide ASPxEdit control just so I can put validation against it?
I think this is what he meant by a feature-gap between DX controls and ASP controls.
regards,
-randall sell
Thank you for your clarification, Randal.
In this case, I believe that you can use ASPxValidationSummary.ValidationGroup to display an error message of an editor (or editors) that has the same ASPxEdit.ValidationSettings.ValidationGroup.You can place the Validation group to any place on a page regardless of the editor's position.
Hello Andrew,
Thank you for contacting us.
I believe you can handle the client-side ASPxClientEdit.Validation event and implement any necessary custom validation in the event handler. Please refer to the Validation - Inplace Validation demo for an example.
If you have any other questions, feel free to contact us at anytime.
Best regards,
Vladimir
Hi Vladimir,
Yes this would work, but it isn't quite the correct solution. It doesn't really make sense to show the message beside any specific checkbox when it applies to all of them. It would work, yes, but it would not meet the requirement the same way that the ASP.NET CustomValidator can. Using the CustomValidator, I can put the error message anywhere on the page.
I believe this is a feature gap between the DevExpress ASP.NET controls and the native ASP.NET validation controls.
Perhaps I can work around this by adding a control, adding my page-wide validation logic to it, and then hiding it with CSS so that only the error message gets displayed when there's an error?
Thanks,
Andrew