Completed
Last Updated: 05 Feb 2016 13:29 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 30 Nov 2015 14:09
Category: GridView
Type: Bug Report
0
FIX. RadGridView - KeyNotFoundException when dragging a UserControl containing a grid to the form
To reproduce:

1. Add a UserControl and drop a RadGridView in it.
2. Use the following code:

public partial class UserControl1 : UserControl
{
    public UserControl1()
    {
        InitializeComponent();
        ColumnGroupsViewDefinition view = new ColumnGroupsViewDefinition();
       
      this.radGridView1.ViewDefinition = view;
        
        view.ColumnGroups.Add(new GridViewColumnGroup("Group"));
        view.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow() );
        GridViewTextBoxColumn col = new GridViewTextBoxColumn("Col1");
        this.radGridView1.Columns.Add(col);
        view.ColumnGroups[0].Rows[0].ColumnNames.Add("Col1");           
    }
}

3. Drag the UserControl from the Toolbox to the form.

Workaround: set the ViewDefinition property after all columns are added.
Attached Files:
0 comments