This question is locked. New answers and comments are not allowed.
Hello,
In our application, we have several grids on one page, many of which have ShowInsertRow=True and a handler for the RowValidating event to implement row validation.
Suppose we click on grid 1's "click here to insert data" row, and try to enter some invalid data - the red exclamation mark appears as expected. If we now click on grid 2's "click here to insert data" row without fixing the invalid row in grid 1, the row in grid 1 is not cancelled. Instead the row in grid 2 is committed immediately, and it too now displays a red exclamation mark in the row header (because an empty row is invalid for us). The application has now hung - we cannot click anywhere in either grid and CPU has risen to 100%.
There is a similar issue with property validation, although instead of the application hanging, both grid 1 and grid 2 try to display their validation error simultaneously (resulting in a flickering effect).
Here is some test code that reproduces the problem. The XAML is simply:
And the code behind:
And the Item class is simply:
Many thanks
Ed
In our application, we have several grids on one page, many of which have ShowInsertRow=True and a handler for the RowValidating event to implement row validation.
Suppose we click on grid 1's "click here to insert data" row, and try to enter some invalid data - the red exclamation mark appears as expected. If we now click on grid 2's "click here to insert data" row without fixing the invalid row in grid 1, the row in grid 1 is not cancelled. Instead the row in grid 2 is committed immediately, and it too now displays a red exclamation mark in the row header (because an empty row is invalid for us). The application has now hung - we cannot click anywhere in either grid and CPU has risen to 100%.
There is a similar issue with property validation, although instead of the application hanging, both grid 1 and grid 2 try to display their validation error simultaneously (resulting in a flickering effect).
Here is some test code that reproduces the problem. The XAML is simply:
<telerik:RadGridView Grid.Row="0" Name="radGridView1" Width="400" ShowGroupPanel="False" ShowInsertRow="True" AddingNewDataItem="radGridView_AddingNewDataItem" RowValidating="radGridView_RowValidating"/><telerik:RadGridView Grid.Row="1" Name="radGridView2" Width="400" ShowGroupPanel="False" ShowInsertRow="True" AddingNewDataItem="radGridView_AddingNewDataItem" RowValidating="radGridView_RowValidating"/>And the code behind:
public partial class MainPage : UserControl{ public MainPage() { InitializeComponent(); SetUpGrids(); } public void SetUpGrids() { this.radGridView1.ItemsSource = new ObservableCollection<Item>(); this.radGridView2.ItemsSource = new ObservableCollection<Item>(); } private void radGridView_AddingNewDataItem(object sender, GridViewAddingNewEventArgs e) { e.NewObject = new Item(); } private void radGridView_RowValidating(object sender, GridViewRowValidatingEventArgs e) { Item entity = e.Row.DataContext as Item; if (entity != null && string.IsNullOrWhiteSpace(entity.Description)) { var validationResult = new GridViewCellValidationResult(); validationResult.ErrorMessage = "Please enter a description."; e.ValidationResults.Add(validationResult); e.IsValid = false; } }}And the Item class is simply:
public class Item{ public string Description { get; set; }}Many thanks
Ed