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
290
Cell edit validation not working
posted

Platform: .NET 3.5 MVC2
Version: 2011.2
Browser: IE8 

We are dynamically building a grid model with cell editing enabled and passing it to a MVC2 view. The editors for each column are numeric with a data mode of DataMode = NumericEditorDataMode.Int. The grid is built to generate columns dynamically based on user input, so using the GridModel was our best choice to avoid unnecessary overhead.

Our issue is that validation is not working and the event 'igvalidatorvalidation' is never fired, even though on 'iggridupdatingeditcellstarted' I can break and see that ui.owner.options.columnSettings[4].editorOptions.validatorOptions are populated correctly based on the GridModel that was passed to the view.

Is there something I'm missing? Here is the relevant code:

var cs = new ColumnUpdatingSetting();
cs.ReadOnly = false;
cs.EditorType = ColumnEditorType.Numeric;
cs.Validation = true;
cs.Required = true;
cs.NumericEditorOptions = new ColumnUpdatingNumericEditorOptions
                                                {
                                                    DataMode = NumericEditorDataMode.Int,
                                                    MinValue = 0,
                                                    MaxValue = 1000000,
                                                    ValidatorOptions = new EditorValidatorOptions
                                                                           {
                                                                               KeepFocus = ValidatorKeepFocus.Always,
                                                                               OnBlur = true,
                                                                               OnChange = true,
                                                                               OnSubmit = true,
                                                                               ShowIcon = true,
                                                                               CustomErrorMessage = "Value must be between 0 and 1 million."
                                                                           }
                                                };
                    filtering.ColumnSettings.Add(new ColumnFilteringSetting { ColumnIndex = i, AllowFiltering = false });


 


 

Parents
No Data
Reply
  • 23953
    Suggested Answer
    Offline posted

    Hi bobegan,

    First I want to apologize for the late answer. I'm volunteer in the forums.

    I was enable to reproduce your problem and it seems that you're not specifying to which column these setting should be applied.

    Add this line to your code and see if it works:

     

    Code Snippet
    1. cs.ColumnKey = "Put your column key here";

     

    Best regards,

    Martin Pavlov

    Infragistics, Inc.

Children
No Data