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

INotifyDataErrorInfo assistance

1 Answer 50 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tyree
Top achievements
Rank 2
Tyree asked on 08 Mar 2011, 02:53 AM
I have just implemented INotifyDataErrorInfo in my RVM's and the behavior I am seeing isn't what I expect but maybe I have something wrong.

I have a column that is bound to a string property through DataMemberBinding with no templates. There is a validation on the column that checks the length of the string entered, if over 8chars it adds an error. So, if I type to long of an entry and attempt to leave the cell I get my validation method message and indicator but then I notice the following:
  1. If I backspace and manually put the data back to the way it was before editing and I leave the cell it never calls Set on that property therefore my vaildation never runs to remove the error...so though the data is correct the row still shows an error indicator. I can leave the cell and edit other stuff...but since the error never gets removed from the collection the row shows errors. This does NOT happen if I use a CellEditTemplate with a textbox with text={binding prop, mode=twoway}.
2.   If I hit Esc, again the Set never fires to verify and remove the error. What do I do about this?

Now I get a weird visual of the error indicator on the cell. My row has no height and there is a stackpanel that has the row showing higher then desired but its testing so who cares. Well, so the row is like 45px tall, but when you put the above string column into edit mode the textbox it shows is only around 20px high. When I type in a long value and the validation shows up I see a validation attached to the textbox, and I see a validation attached to the cell...so I see two indicators on a single cell.

So how do I properly clear the error collection when the grid doesn't call setter? Not gonna do this in code behind events - what other options are there?

Thank you

1 Answer, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 11 Mar 2011, 10:20 AM
Hi Tyree,

The problem comes from the fact that RadGridView doesn't update property if there is no need (when value within the editor is same as current property value). We will reconsider our logic when dealing with such scenarios.
I guess that when you detect an invalid data within the property setter you raise INotifyDataErrorInfo.ErrorsChanged event without setting the "wrong" value to the property. Could you please try to set the "wrong" value before ErrorsChanged event?
Let me know how it goes and if this doesn't help please send me your sample application in order to debug it on my side.
Thank you in advance.

Regards,
Nedyalko Nikolov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
GridView
Asked by
Tyree
Top achievements
Rank 2
Answers by
Nedyalko Nikolov
Telerik team
Share this question
or