Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
830
NumericEditorProvider: display alert error messages
posted

Hi,

 

Pls, how can I display an alert message when user tries to enter a non numeric value or when they try to exceed the maximum number allowed by the property: EditorControl-MaxValue i my  NumericEditorProvider

 

I need to display alert message: alert('only values less than 99999 allowed")  when they are entering larger values or if they hit non numeric key

Not sure how to connect a javascript function for this behaviour. Here is my javascript function:

function isBetweenn_0_99999(evt, ctrl) {
            var result = isNumberFullKey(evt);
            if (result) {
                //clearSelection(ctrl)
                if (ctrl.value > 9999 || ctrl.value < -9999) {
                    alert("Le champ accepte seulement des valeurs entre -99999 et 99999")
                    return false;
                }
                return true;
            }
            return false;
        }

   function isNumberFullKey(evt) {
    var charCode = (evt.which) ? evt.which : evt.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode != 45) {
        alert("Le champ n'accepte que les valeurs entières");
        return false;
    }

    return stopRKey(evt);
}

thank u :)

  • 49378
    posted

    Hi rtutus,

    It has been some time since your post, however in case you still need assistance I would be glad to help.

    In this scenario you could use the ValueChanging client-side event in order to  execute you function and display an alert message.

    However, as the grid's numeric provider only prohibits values outside of the range to be entered in the grid, I would suggest that you consider using a RangeValidator in order to display your error messages. You can find a detailed guide for incorporating validation in WebDataGrid at:

    http://blogs.infragistics.com/aspnet/articles/webdatagrid-validation.aspx

    Please feel free to contact me if you have any questions.

    Best Regards,

    Petar Ivanov
    Developer Support Engineer
    Infragistics, Inc.
    http://es.infragistics.com/support