Current filter:
                                You should refresh the page.
                                  • Hi support,

                                    Currently I have a form with a spinedit. This spinedit gets his value by the SpinEditFor functionality. As model type it is an int?. When I submit the form the spinedit wil be submitted. I use an int? instead of an int because I do not want a zero in the spinedit when the value is empty. But when I submit the spinedit with a null value/empty the validation will also not be triggered. Obvious because it is a nullable int. But I like to validate an error when the value is null. Is this somehow possible?

                                    Roel

                                • Lanette (DevExpress Support) 01.14.2020

                                  Hello,

                                  I'm afraid that your scenario is not fully clear. Why do you set the field to the nullable integer type if you need to implement validation that will not allow a user to enter empty or null values? Do you use this type to address the cases when the corresponding data source field contains null values? Please describe your requirements and scenario in greater detail. This will help us provide you with recommendations.

                                • Roel Alblas (Trin-iT) 01.16.2020

                                  Hi,

                                  [VB]
                                  Why do you set the field to the nullable integer type if you need to implement validation that will not allow a user to enter empty or null values?

                                  The only reason is that I do not want a zero in the spinedit when the user has not filled in any data yet. If I do want a zero in the spinedit, I can set the property Number to zero. In comboboxes we can set that null values are allowed. Is something like that also possible in the spinedit.

                                  Roel

                                1 Solution

                                Creation Date Importance Sort by

                                Hello,

                                Thank you for your clarification.
                                If you wish to implement custom model-based validation on the client side, you can create a custom data annotation attribute. Please see the following resources for additional details:
                                Custom Validation in ASP.NET MVC
                                GridView - How to perform a custom client side unobtrusive validation for the EditForm template using a custom attribute

                                Let us know if this approach meets your requirements.