Declined
Last Updated: 20 Oct 2015 14:28 by ADMIN
ADMIN
Dimitar
Created on: 17 Jul 2015 11:07
Category: GridView
Type: Bug Report
1
FIX. RadGridView - when self-refence rows are reloaded in the grid, the enitre column is selected.
To reproduce:
protected override void OnLoad(EventArgs e)
{
    this.radGridView1.AllowAddNewRow = false;
    this.radGridView1.TableElement.RowHeight = 40;

    this.radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;        
    GridViewTextBoxColumn id = new GridViewTextBoxColumn("ID");
    id.IsVisible = false;
    GridViewTextBoxColumn parentID = new GridViewTextBoxColumn("ParentID");
    parentID.IsVisible = false;
    GridViewTextBoxColumn name = new GridViewTextBoxColumn("Name");
    GridViewDateTimeColumn date = new GridViewDateTimeColumn("Date");
    GridViewTextBoxColumn type = new GridViewTextBoxColumn("Type");
    GridViewTextBoxColumn size = new GridViewTextBoxColumn("Size");
    size.FormatString = "{0} MB";
    radGridView1.Columns.AddRange(new GridViewDataColumn[]
    {
        id,
        parentID,
        name,
        date,
        type,
        size
    });

    this.radGridView1.Relations.AddSelfReference(this.radGridView1.MasterTemplate, "ID", "ParentID");

    radGridView1.CellValueChanged += radGridView1_CellValueChanged;
    fillData();
}



void radGridView1_CellValueChanged(object sender, GridViewCellEventArgs e)
{
    fillData();
}

private void fillData()
{     
    radGridView1.Rows.Clear();
   
    radGridView1.Rows.Add(1, null, "Program Files", DateTime.Now.AddDays(-100), "Folder", 5120);
    radGridView1.Rows.Add(2, 1, "Visual Studio 2010", DateTime.Now.AddDays(-100), "Folder", 3220);
    radGridView1.Rows.Add(3, 2, "bin", DateTime.Now.AddDays(-100), "Folder", 3220);
    radGridView1.Rows.Add(4, 2, "READEME.txt", DateTime.Now.AddDays(-100), "Text Document", 3);
    radGridView1.Rows.Add(100, null, "Test.txt", DateTime.Now.AddDays(-10), "Text File", 0);

    radGridView1.Rows.Add(5, 1, "Telerik RadControls", DateTime.Now.AddDays(-10), "Folder", 3120);
    radGridView1.Rows.Add(6, 5, "Telerik UI for Winforms", DateTime.Now.AddDays(-10), "Folder", 101);
    radGridView1.Rows.Add(7, 5, "Telerik UI for Silverlight", DateTime.Now.AddDays(-10), "Folder", 123);
    radGridView1.Rows.Add(8, 5, "Telerik UI for WPF", DateTime.Now.AddDays(-10), "Folder", 221);
    radGridView1.Rows.Add(9, 5, "Telerik UI for ASP.NET AJAX", DateTime.Now.AddDays(-10), "Folder", 121);

    radGridView1.Rows.Add(10, 1, "Microsoft Office 2010", DateTime.Now.AddDays(-120), "Folder", 1230);
    radGridView1.Rows.Add(11, 10, "Microsoft Word 2010", DateTime.Now.AddDays(-120), "Folder", 1230);
    radGridView1.Rows.Add(12, 10, "Microsoft Excel 2010", DateTime.Now.AddDays(-120), "Folder", 1230);
    radGridView1.Rows.Add(13, 10, "Microsoft Powerpoint 2010", DateTime.Now.AddDays(-120), "Folder", 1230);

    radGridView1.Rows.Add(14, 1, "Debug Diagnostic Tools v1.0", DateTime.Now.AddDays(-400), "Folder", 2120);
    radGridView1.Rows.Add(15, 1, "Designer's 3D Tools", DateTime.Now.AddDays(-500), "Folder", 1120);
    radGridView1.Rows.Add(16, 1, "Communication", DateTime.Now.AddDays(-700), "Folder", 120);
}

Then start the application edit a value and click another cell.

Workaround:
- Enclose the rows addition within Begin/End update block.
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
3 comments
ADMIN
Stefan
Posted on: 20 Oct 2015 14:28
Hi Asif,

Please excuse us for the introduced confusion. The item is declined, as with the current design of RadGridView, such a scenario is not supported. The scheduled release is just for information when we have handled/worked on this case.

Should you need to add rows in the CellValueChanged event, you should use the workaround provided at the end of the item description.
Asif
Posted on: 15 Oct 2015 10:51
I don't get it, first it was declined, and now I am seeing it to be scheduled for Q3 2015 SP1,

which one is right?
ADMIN
Ivan Petrov
Posted on: 24 Sep 2015 08:28
The behavior of RadGridView is dictated by its internal design. When the user presses the Tab key, the grid starts a CurrentChanged operation that will change the current column. When an operation is started, in the grid, the same operation cannot be started until the previous one has completed. Within the scope of the CurrentChange in the above case, the grid calls EndEdit so it can save the editor value. When the value of the editor is saved the CellValueChanged is fired. Within the event handler, new rows are added to the grid. When new rows are added to the grid they are marked as current. When that happens a CurrentChanged operation is started and the old current row is marked as not current. In this case, though, the CurrentChanged operation is suspended and, as a result, no one notifies the already added rows in the grid that they should be marked as not current. This way all the added rows are marked as current and their visual style reflects that.