Hi,
I am using an UltraWinGrid with a RowEditTemplate in a form. When the user clicks the edit button the RowEditTemplate appears. It contains two fields, a Name and Description for a data bound object. The Name is a required field. I have replaced the auto generated proxy fields in the RowEditTemplate with my own UltraTextEdit fields which i bind with my underlying object. I also have an ErrorProvider control on the form. When the RowEditTemplate appears i clone the row's underlying object and bind the controls of the RowEditTemplate with the cloned object. I would like to update the row cells only when the user clicks ok button by copying the cloned object's properties to the initial object properties. The problem is that when the user deletes the name on the RowEditTemplate and tries to nagigate away from the control, it cannot loose focus. The ErrorProvider correctly shows the required message but Name control cannot loose focus. The AutoValidate on the form is set to EnableAllowFocusChange. I did also try to create two UltraTextEdit controls out of the RowEditTemplate, on the same form, bound to the same object like the controls on the Template. Validation works as expected on these controls and Name control can loose focus.It seems like RowEditTemplate ignores the AutoValidate Property of the form even when the bound object is not this of the edited row but a cloned one.
I would like the user to be notified of the Error on the appropriate control on the RowEditTemplate and the same time to allow the user to navigate to another control on the RowEditTemplate. Any ideas?
Hi Kostas,
I ran your sample and I get the same results. I spent some time trying to figure out why it's behaving differently on the RowEditTemplate, but I can't see any reason for this. The RowEditTemplate is contained within the same form. If I put the UltraTextEditor that is directly on the form into a panel or other container, it works just the same. So I can't see why the RET should be any different.
I'm going to forward this over to Infragistics Developer Support so they can write it up as a potential bug and we can look into it in more detail.
Mike, thank you for your time.I have uploaded a sample project demonstrating the issue.I have created the project using VS2008 and used infragistics controls Version 10.1.20101.1007.
The project is an executable with one form. On the right you will find an UltraGrid with a RowEditTemplate attached and on the left two UtraTextEdit controls. Just click on any cell on the grid to make the RowEditTemplate appear. Then try to delete the Name field both on the tmplate and the UltraTextEdit control on the form. Try to navigate away from the Name editor into the description editor and you will see that this is possible only on the form.
P.S. Just for this case I have made the RowEditTemplate to be modeless so that it would be possible for you to test the binding behavior on the controls on the form.
Thanks, Kostas
Okay, if that's the case, then it sounds like there is something wrong there.
I'm not familiar enough with the inner workings of the RowEditTemplate to say off the top of my head if there's a way to do this. Can you provide a small sample project that demonstrates the behavior you are getting so we can check it out? It sounds like this may be a bug, but we'd have to delve into the code and so some testing to be sure.
Well Mike, as I said the data object does not allow null in the Name field and this is what the business logic requires. Anyway properties on the data object or the data object itself is certainly not the case. And that is because when I place the UltraTextEdit control on a Windows Form, bind it with the Name field of the same business object and set the form's AutoValidate property to EnableAllowFocusChange, it behaves as expected. When the user deletes the text from the text control and tries to navigate away from the control the ErrorProvider correctly shows the Message "Name is a required field" and the UltraTextEdit control loses focus. Focus is lost because the AutoValidate property of the form is set to EnableAllowFocusChange. That's what this property is supposed to do. It should allow the focus to be lost from an input control when validation fails.
Now, regarding the RowEditTemplateControl. My initial question was: Can the same behavior be achieved within a RowEditTemplateControl? Does the RowEditTemplate control respect the AutoValidate property of the form?
I remind you that I have tried binding exactly the same business object to an UltraTextEdit control on a Windows Form and a RowEditTemplate control. When validation fails, on the Windows form the UltraTextEdit control can lose focus but on the RowEditTemplate it cannot.
Does your data object allow null in the Name field? My guess is that the UltraTextEditor will not allow itself to lose focus, because it is unable to write a null value to the data source. If that's the case, you might be able to get around that by setting certain properties on the Binding object when you bind it.