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

Telerik Grid validation

9 Answers 261 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Minal
Top achievements
Rank 1
Minal asked on 16 Mar 2011, 08:30 PM
In the radgrid the user is allowed to add/edit/delete rows.

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

Sort by
0
Maya
Telerik team
answered on 21 Mar 2011, 03:12 PM
Hi Minal,

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.
 

Greetings,
Maya
the Telerik team
0
Minal
Top achievements
Rank 1
answered on 22 Mar 2011, 12:15 AM
Thanks Maya. I still see the same issue in the sample application you have sent. For example if I delete the value of a cell in the 'Stadium' column the default Telerik error message 'Input is not in the correct format' is shown and then it does not allow the control to move away from that cell to anything else until the user enters a correct value that passes the validation check.

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()

0
Maya
Telerik team
answered on 22 Mar 2011, 09:48 AM
Hello Minal,

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. 

Greetings,
Maya
the Telerik team
0
Mircea
Top achievements
Rank 1
answered on 26 May 2011, 02:17 PM
I don't know if it is too late but,

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.
0
Vimal
Top achievements
Rank 1
answered on 08 Jun 2011, 01:44 PM
Hi,

    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.
0
Maya
Telerik team
answered on 08 Jun 2011, 02:40 PM
Hello Craig,

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. 

All the best,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Vimal
Top achievements
Rank 1
answered on 10 Jun 2011, 06:03 AM
Dear Maya,

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.
0
Mircea
Top achievements
Rank 1
answered on 10 Jun 2011, 04:38 PM
@Craig

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.
0
Maya
Telerik team
answered on 13 Jun 2011, 12:41 PM
Hello Craig,

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.

Greetings,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Minal
Top achievements
Rank 1
Answers by
Maya
Telerik team
Minal
Top achievements
Rank 1
Mircea
Top achievements
Rank 1
Vimal
Top achievements
Rank 1
Share this question
or