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

Exit from edit mode with validation errors

4 Answers 349 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Roberto
Top achievements
Rank 1
Roberto asked on 06 Oct 2010, 04:02 PM
Hi,

I have a RadGridView in which the user can edit cells and the content is validated.
The problem is that when an error occour the cell remain in edit mode until the input is validated again.
I would like that the user can add invalid input. Is it possible?

Thanks,
Roberto.

4 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 07 Oct 2010, 07:31 AM
Hi Roberto,

In order to exit from the "error" state, you may just press twice the Esc button. However, if you do not want the validation to fire, you handle the validating events of the grid. You may find more information about Validation in our online documentation.

Kind regards,
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
Steve Evans
Top achievements
Rank 1
answered on 14 Oct 2010, 02:54 PM
Hi,

I have a scenario where I present the user with a dialogue comprising: ok, cancel and a grid into which some data is required to be entered. In the scenario in which there is invalid data in a cell the cancel button can NOT be clicked and by that I mean that the only event that gets seems to get fired is the cellvalidating event.

I want the user to be able to cancel irrespective of whether the grid has valid or invalid data in it.

Please advise.

Thanks, Steve
0
Maya
Telerik team
answered on 15 Oct 2010, 01:12 PM
Hello Steve Evans,

In order to meet your requirements for cancelling even an invalid value, you may implement the following logic:
1. Define a RadButton:

<telerik:RadButton Content="Cancel"           
                   Command="telerik:RadGridViewCommands.CancelRowEdit"
                   CommandTarget="{Binding ElementName=clubsGrid}"  />

2. Set the Property of RadGridView ActionOnLostFocus:
<telerik:RadGridView Name="clubsGrid"
        RowValidating="clubsGrid_RowValidating"
        ActionOnLostFocus="None"
        ItemsSource="{Binding Clubs}"
        AutoGenerateColumns="False" >

The second steps is necessary as the default behavior of the grid on LostFocus is to commit edit

 

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
0
Steve Evans
Top achievements
Rank 1
answered on 15 Oct 2010, 02:42 PM
Just what I needed. Thank you  very much.

Steve
Tags
GridView
Asked by
Roberto
Top achievements
Rank 1
Answers by
Maya
Telerik team
Steve Evans
Top achievements
Rank 1
Share this question
or