Completed
Last Updated: 30 Jul 2013 03:09 by ADMIN
ADMIN
Georgi I. Georgiev
Created on: 30 Jul 2013 03:09
Category: GridView
Type: Bug Report
0
FIX. RadGridView - NullReferenceException on shift + down or shift + up in hierarchical grid
To reproduce:
Generate the hierarchy with the following code:
radGridView1.SelectionMode = GridViewSelectionMode.CellSelect;
            radGridView1.MultiSelect = true;
            radGridView1.ClipboardCopyMode = GridViewClipboardCopyMode.EnableWithoutHeaderText;
            radGridView1.ClipboardPasteMode = GridViewClipboardPasteMode.Enable;
            radGridView1.AutoGenerateColumns = true;

            radGridView1.CellValueChanged += grid_CellValueChanged;
            //radGridView1.ViewCellFormatting += GridCellFormatting;
            //radGridView1.RowFormatting += grid_RowFormatting;
            radGridView1.EnableSorting = true;
            //radGridView1.MasterTemplate.EnableCustomSorting = true;
            radGridView1.AllowMultiColumnSorting = true;
            radGridView1.ShowGroupPanel = true;
            radGridView1.EnableFiltering = true;
            radGridView1.ShowFilteringRow = false;
            radGridView1.MasterTemplate.ShowHeaderCellButtons = true;

            DataTable dt1 = new DataTable();
            dt1.Columns.Add("Column1");
            dt1.Columns.Add("Column2");
            dt1.Columns.Add("Column3");
            dt1.Columns.Add("Column4");
            dt1.Columns.Add("Column5");
            dt1.Columns.Add("Column6");
            dt1.Columns.Add("Column7");
            dt1.Columns.Add("Column8");
            dt1.Columns.Add("Column9");
            dt1.Columns.Add("Column10");
            DataTable dt2 = new DataTable();
            dt2.Columns.Add("Column1");
            dt2.Columns.Add("Column2");
            dt2.Columns.Add("Column3");
            dt2.Columns.Add("Column4");
            dt2.Columns.Add("Column5");
            dt2.Columns.Add("Column6");
            dt2.Columns.Add("Column7");
            dt2.Columns.Add("Column8");
            dt2.Columns.Add("Column9");

            var temp = new GridViewTemplate();
            temp.AutoGenerateColumns = true;
            radGridView1.Templates.Add(temp);
            var rel = new GridViewRelation(radGridView1.MasterTemplate, temp);
            rel.ChildColumnNames.Add("Column1");
            rel.ParentColumnNames.Add("Column1");
            radGridView1.Relations.Add(rel);

            radGridView1.MasterTemplate.DataSource = dt1;
            dt1.Rows.Add(1, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6, 9);
            dt1.Rows.Add(2, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6, 9);
            dt1.Rows.Add(3, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6, 9);
            dt1.Rows.Add(4, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6, 9);
            dt1.Rows.Add(5, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6, 9);

            dt2.Rows.Add(1, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6);
            dt2.Rows.Add(1, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6);
            dt2.Rows.Add(1, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6);
            dt2.Rows.Add(2, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6);
            dt2.Rows.Add(2, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6);
            temp.DataSource = dt2;

1. Run the project with the generated hierarchy
2. Select Last cell in first row. (there is no "Column9" in Child Template)
3. Expand first row and select any cell in first child row.
4. Hold Shift-Key and press down arrow or up arrow until you receive a NullReferenceException.
0 comments