This is a migrated thread and some comments may be shown as answers.

Empty row validation tooltip

8 Answers 313 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Moyle
Top achievements
Rank 1
Moyle asked on 09 Apr 2019, 07:47 AM

Hello,

I use a RadGridView and validate my data by implementing the INotifyDataErrorInfo interface.
It works well, but when there is a validation error, the tooltip of the row header is empty.
Could you please tell me how to fill the tooltip of the row header with the validation error messages?

Example: https://file.io/rEm4Fd (link valid until Tuesday 16th of April 2019)

8 Answers, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 11 Apr 2019, 12:35 PM
Hello,

Thank you for the attached picture. 

We are already aware of the described behavior and it is logged in our feedback portal: GridView: An empty validation tooltip is displayed for the RowIndicator when validating in edit mode. You can follow the item in order to get notified for any developments.

For the time being, what I can suggest is setting the ValidatesOnDataErrors property of RadGridView to InViewMode. This way the validation tooltip visualizes the errors as expected.

I hope you find this helpful.

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Moyle
Top achievements
Rank 1
answered on 17 Apr 2019, 11:20 AM

Hello,

Thanks for your answer.

Your workaround works well, but my problem is a bit more complex:
The validation of my object is not triggered by the editing of a cell but by a button command, such as for a "Save" button.
And when the validation errors are added this way, the row header error tooltip remains empty although the row is highlighted.
If I then edit the cell then exit it with enter, the row header error tooltip is filled with the error message.
How could I have the row header error tooltip filled when the validation is done without interaction with the grid?
I updated my example accordingly to my explanations.

Example project

Regards

0
Vladimir Stoyanov
Telerik team
answered on 22 Apr 2019, 09:42 AM
Hello,

Thank you for the additional information.

I was not able to download the modified sample project, since I am getting a "File not found" error. That said, I believe that I was able to reproduce the described behavior on my end.

In order for the validation error to be displayed correctly when the validation is not performed during editing, you can call the Rebind method of the RadGridView after the validation errors are added. I am attaching the ValidationINotifyDataErrorInfo SDK example modified to demonstrate what I have in mind. Please, check it out and let me know, if it helps.

I am looking forward to your reply.
 
Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Moyle
Top achievements
Rank 1
answered on 03 May 2019, 11:28 AM

Hello,

Thanks for your answer.
I put in place your solution by calling the Rebind method when a GridRow becomes invalid.
It works, but if the Grid has the property AutoGenerateColumns set to False, I get the following exception: Object reference not set to an instance of an object.

   at Telerik.Windows.Controls.GridView.GridViewRow.ApplyHierarchyExpandButtonStyle()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.ApplyRowStyle(GridViewRow row)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.PrepareContainerForItemOverride(DependencyObject element, Object item)
   at Telerik.Windows.Controls.GridView.BaseItemsControl.Telerik.Windows.Controls.GridView.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item)
   at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container)
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.NestedLayoutStrategy.InsertContainer(Int32 childIndex, UIElement container, Boolean isRecycled)
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.NestedLayoutStrategy.AddContainerFromGenerator(Int32 childIndex, UIElement child, Boolean newlyRealized)
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.NestedLayoutStrategy.GenerateNextChild(IItemContainerGenerator generator, Int32 childIndex)
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.NestedLayoutStrategy.MeasureOverride(Size constraint)
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
   at RadGridView.App.Main()

Could you please help me to use the Rebind method in a MVVM project to get the validation error tooltip working ?
I updated my example accordingly to my explanations:

https://file.io/0uJp18

0
Moyle
Top achievements
Rank 1
answered on 03 May 2019, 01:57 PM

Hi, sorry I noticed that that service allows only 1 download

Here is another link:

https://drive.google.com/file/d/1rolSmg1wwFZN0ztnr40a_HCac33_lrxC/view

0
Vladimir Stoyanov
Telerik team
answered on 07 May 2019, 12:07 PM
Hello,

Thank you for the provided project. 

I removed the reference to the morelinq dll, since it was missing in order to run the project. I investigated it and I would recommend relying on a property in the viewmodel or the view in order to trigger the Rebind method of the RadGridView, instead of the IsValid property of the GridViewRow.

I modified the sample project in order to demonstrate this approach for your reference using the HasErrors property in the view model. With this approach, I was not able to reproduce the described exception.

Note, that you can also set the behavior to the RadGridView itself, since the IsValid property of the rows is not used. Please, check out the modified version of the project and let me know, if you find it helpful.

I am looking forward to your reply.

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Moyle
Top achievements
Rank 1
answered on 17 May 2019, 02:47 PM

Hello,

Thanks for your solution.
It works well, but if I set the following RadGridView properties it doesn’t work anymore:
<Setter Property="EnableColumnVirtualization" Value="False" />
<Setter Property="AutoGenerateColumns" Value="False" />

Here is the updated example project.

There are two behaviors: the one from your previous solution which applies on RadGridView and mine which applies on GridViewRow. Neither of them are working.

Furthermore, in our actual project, even when setting EnableColumnVirtualization to True, it still doesn't work, but we haven't been able to pinpoint the difference with the example project that makes it behave differently. We're hoping that if you find a workaround for the example project, it will also work for our actual project.

Regards,

0
Vladimir Stoyanov
Telerik team
answered on 21 May 2019, 01:03 PM
Hello Moyle,

Thank you for the modified project and the additional information.

I tried setting the EnableColumnVirtualization to True in the sample project and the validation error is displayed as intended on my end. Can you confirm whether this is the observed behavior on your end as well with the attached project? 

Please, note that disabling the column virtualization is generally not recommended. That said, if the undesired behavior is reproduced in your main project with the column virtualization enabled, may I kindly ask you to isolate this behavior in the sample project and send it over? This way I will be able to investigate the scenario in detail and hopefully suggest a suitable solution.

On a side note, you can also try Validating Data Through Data Annotations or with IDataErrorInfo.

I am looking forward to your reply.

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Moyle
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Moyle
Top achievements
Rank 1
Share this question
or