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
4160
Where should be validated the input data when using a DataFilter?
posted

Hello

Data format Validation should be validated inside the Convert method or the grid events should be used instead? what is the best practice?

Thanks a lot.

  • 48586
    posted

    Hello,

    IDataFilterInterface was designed to be middle part between actual data and this what the customer sees. It just represents data from one to another form, so if you make any validation there, then you should invent a mechanism, which will notify the grid not to update actual data, because even if you have invalid data  IDataFilterInterface should pass something to the grid (null or other representation of the data). Also Convert method of IDataFilterInterface is firing several times for each input character, so if yours data validation is more complex, it could slow your application. The most appropriate event for validation is BeforeCellUpdate event of the grid. If the data validation does not meet the criterias, you could cancel updating of the cell data with setting e.Cancel = true.

    Please let me know if you have any further questions.

  • 48586
    posted

    Hi,

     

    I just wanted to know if you were able to solve your issue based on my suggestions or you still need help? Just let me know.

    Thank you.