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
70
Need guidance on this custom grid cell editor use case
posted

I have a use case where I'm creating a new control derived from UltraTextEditor. This control needs to do the following:

1. Allow the user to type in any string

2. Once they try to commit their input (by exiting edit mode) it needs to examine the text entered using a custom mechanism

3. If our custom validation fails then the cell should remain in edit mode until a valid value has been entered (or the user discards their change via <Esc>)

My problem is that our custom validation mechanism will need to display modal dialogs and possibly another custom form before returning control back to the grid. My previous attempt at this was to hook into the BeforeExitEditMode event within my derived editor, but that results in two events being fired because (I suspect) the message box displayed takes focus from the cell. So that gets me into a mode of hacking some sort of tracking mechanism to know if I'm in the first or second firing of the event...which is something I really want to avoid. It makes me feel like there *has* to be a better way...

So what I'm hoping to get is some guidance on how to properly handle this use case with an Infragistic grid. I've started to explore the UltraValidator component, but it's very tough to understand how to apply it to a cell editor, and I'm not sure the custom validation we need would be allowed by it. Is there a good pattern to follow here?

Parents
No Data
Reply
  • 9298
    Suggested Answer
    posted

    Sam,

    I have attached here a simple sample application which I hope will give you an idea of how you could use the UltraValidator with an UltraTextEditor that is assigned to the EditorComponent of a column in the grid.  You will see that in the "Name" column of the grid the text must be "Storie" and if you try to type in anything else you will be forced to remain in that cell until you give it a valid string.  I hope this will help to get you started.  Let me know if you have further questions about this.

    ValidationTest.zip
Children
No Data