Completed
Last Updated: 18 May 2017 13:01 by ADMIN
ADMIN
Dimitar
Created on: 13 Feb 2017 13:58
Category: GridView
Type: Bug Report
2
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.

Workaround:
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");
}
1 comment
ADMIN
Ralitsa
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;
}