Last Updated: 18 May 2017 13:01 by ADMIN
Created on: 13 Feb 2017 13:58
Category: GridView
Type: Bug Report
FIX. RadGridView - new row with predefined values is not added to grid.
To reproduce:
- Add default values for all cells in the grid.
- Try to add the new row without changing any value.

private void RadGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
    var editor = radGridView1.ActiveEditor as BaseInputEditor;
    var field = editor.GetType().GetField("originalValue", BindingFlags.NonPublic | BindingFlags.Instance);
    field.SetValue(editor, "asd");
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
1 comment
Posted on: 18 May 2017 13:01
In order to add a new row with default values without changing them, you need to handle the DefaultValuesNeeded event and set the AddWithDefaultValues property to true. The code snippet below demonstrating how to achieve it:  
void radGridView1_DefaultValuesNeeded(object sender, Telerik.WinControls.UI.GridViewRowEventArgs e)
    var args = e as DefaultValesNeeedEventArgs;
    args.AddWithDefaultValues = true;