When a new row is added one of the columns is required so we have a cell level validation that the particular column value is not entered as null or empty This works fine using the Silverlight validation framework.
But if the user decides to to delete that row and not enter anything in that cell when the validation is fired and the red border and error message is shown until the user does not enter something in the cell the user is not able to do anything in the screen. This validation error seems to block everything on the screen. When we press the Escape key 2-3 times then the validation error seems to go away. This is not intuitive for the user.
How can this be handled so that the validation error is shown but it does not block the screen completely and the user is able to delete the row?
9 Answers, 1 is accepted
I am sending you a sample project illustrating a possible approach for handling that scenario. Generally, the idea is that your business object needs to implement IEditableObject and INotifyDataErorInfo Interfaces. Thus the focus will be removed from a cell even if it has a validation error and you will be able to delete it too.
Let me know whether this corresponds to your requirements.
Maya
the Telerik team
What I want is that when the validation error is shown the user should be able to select the row and delete it which is not happening currently. Please check the attached screen shot.
The only way to be able to come out of this locked state is use the escape key. I see a difference in behaviour when the telerik 'Input is not in the correct format' is shown vs when a validation error is thrown for
ValidateStadiumCapacity()
The error displayed when leaving the StadiumCapacity column is displayed as the property itself cannot accept null values. Once you define this property to be nullable, it will not be visualized.
However, this validation is handled by the Framework - it is not permitted to insert string values in a int-field, null in non-nullable fields. Consequently, you cannot escape the failing validation and focus another cell until entering correct value.
Maya
the Telerik team
The RadGrid has a property that tells it what to do when it loses the focus: ActionOnLostFocus which by default is set to Commit.
Whenever the grid senses it loses the focus it will try to commit the changes which in turn causes an automatic validation of everything that changed, hence your cell with the invalid value will block everything.
If you can afford to handle the commiting of changes on another occasion: when leaving the page or through a button for example, you could set ActionOnLostFocus to None which may end your predicament. It will allow you to do anything you want as it will not indirectly trigger validation anymore.
Hope this helps.
I have the same issue with Telerik Grid Validation. The application attached with this does not solve the problem.
If you empty the "stadium" and Try to move to any other cell or Control it will not allow to move next.
Please let us know how should achieve this.
Regards,
123Insight Team Member.
As mentioned previously, validation handled by the Framework - as it is the case when inserting null value for a non-nullable property cannot be escaped. Thus the focus will stay on that particular cell until being updated with a value.
Maya
the Telerik team
Can you please tell us what will be the alternative to achieve this? This is client requirement and we have to do it by any way ...
Please guid us. Your help will be really appreciated.
Regards,
123Insight Team Member.
Have you tried the ActionOnLostFocus setting as in one of the above posts?
Or, if that's not applicable to your situation you may use a CustomValidator which you can adjust to accept exceptions.
I have been through this so I can provide you with some pointers if you are willing to detail a bit your situation.
Cheers.
Unfortunately, the scenario described is handled by the Framework, not by the RadGridView and it is beyond the capabilities of a control to change it. A possible scenario may be to slightly change scenario. For example, you may bind the value through a converter and if the value is null, you may display a "null" string. Afterwards, during the validation, you may perform a check if the value is "null" and execute the logic illustrated in the sample project.
Maya
the Telerik team