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?
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.
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.
It's pretty tough to guess why this isn't working without seeing exactly what you are doing. Could you reproduce this in a small sample project?
Hi Mike,
I have a grid with 4 columns. I am creating Rowedittemplate in runtime. I want to bind an user control for a cell. Is it possible?
I tried the following code to bind.
dim loCell as new uiTextcontrol
loCell.DataBindings.Add(
"Text", uiRowEditTemplate, QbGrid.DisplayLayout.Bands(0).Columns(lnCnt).Key)
My usercontrol having 3 controls. 2 label controls and a text box. I have a property "Text" & "Value" for the user control which actually gives/sets the value or text to the textbox inside the usercontrol.
The usercontrol is displaying on the row edit template. But the value is not coming from the grid cell and viceversia. Please guide me?. Whether i have to set any property?
Hi Kostas,
I think you will be receiving a notification from Developer Support soon, if you have not already, but I just wanted to let you know that we have resolved the issue here.
This turns out not to be a bug, per se. What's happening is that you are setting the AutoValidate property on the main form in your application to EnableAllowFocusChange. But this has no effect on the RowEditTemplate, because theRowEditTemplate is not on this form. The RET creates it's own dialog to display itself and no one is setting AutoValidate on this RET form.
So, you can easily work around this issue by setting AutoValidate on the dialog that is created by the RET. Like so:
private void BusinessObjectsGrid_AfterRowEditTemplateDisplayed(object sender, AfterRowEditTemplateDisplayedEventArgs e) { Form form = e.Template.FindForm(); if (form != null && form != this) { form.AutoValidate = AutoValidate.EnableAllowFocusChange; } }
This was pretty tough to figure out, though. So to make things easier, we will be adding an AutoValidate property to the DialogSettings of the RET. This will be in the next service release.
Note that this property cannot be exposed in the property grid at design-time for v9.2 and v10.1, since this would cause issues with backward compatibility. So the property is available in those (older) versions only at run-time. In v10.2 and up, the property will display in the property grid as normal.
Hi Konstantinos,
I have created a support case with number CAS-44479-0LGXFV. If you have any further questions please update them to the created case or if you want to check the progress of this issue.
Best Regards,
Stefaniya
Developer Support Engineer
Infragistics, Inc
http://ko.infragistics.com/support
Thank you Mike,
Please update this post when you have something new.