Completed
Last Updated: 11 Sep 2015 11:16 by ADMIN
Completed
Last Updated: 21 Jul 2015 15:47 by ADMIN
Workaround:  set the data type of the column to null before saving the layout and after loading it set it with the needed type
Completed
Last Updated: 14 Jul 2015 13:16 by ADMIN
ADMIN
Created by: Dess | Tech Support Engineer, Principal
Comments: 0
Category: GridView
Type: Bug Report
0
Use the following help article to set up the hierarchy >> http://www.telerik.com/help/winforms/gridview-hierarchical-grid-self-referencing-hierarchy.html

Please refer to the attached gif files illustrating the behavior in Q1 SP and Q2.
Declined
Last Updated: 22 Jul 2015 14:46 by ADMIN
There should be a Enum (Left, Right, None) property of the Expander Column indicating whether the position of the expander column should be left right or none.  This would be especially important during pinning activities meaning no matter how many columns are being pinned and repositioned in the pinned area of the grid, it would always remain on the left, right or none.
Completed
Last Updated: 14 Dec 2016 12:02 by Dickson
Declined
Last Updated: 15 Oct 2015 10:42 by ADMIN
BindingList<Item> items = new BindingList<Item>();

public Form1()
{
    InitializeComponent();

    for (int i = 0; i < 20; i++)
    {
        items.Add(new Item(i % 4, "Item" + i, "Type" + i % 2));
    }
    this.radGridView1.DataSource = items;
    this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
}

public class Item
{
    public int Id { get; set; }

    public string Name { get; set; }

    public string Type { get; set; }

    public Item(int id, string name, string type)
    {
        this.Id = id;
        this.Name = name;
        this.Type = type;
    }
}

private void radButton1_Click(object sender, EventArgs e)
{
    items.Insert(0, new Item(2, "Test", "Type0"));
}

WORKAROUND I:

GridViewSynchronizationService.SuspendEvent(this.radGridView1.MasterTemplate, KnownEvents.CurrentChanged);
Item item = new Item(2, "Test", "Type0");
items.Insert(0, item);
GridViewSynchronizationService.ResumeEvent(this.radGridView1.MasterTemplate, KnownEvents.CurrentChanged);

foreach (GridViewRowInfo row in this.radGridView1.Rows)
{
    if (row.DataBoundItem == item)
    {
        this.radGridView1.CurrentRow = row;

        break;
    }
}



WORKAROUND II:

this.radGridView1.Rows.CollectionChanged += Rows_CollectionChanged;
this.radGridView1.GroupExpanding+=radGridView1_GroupExpanding;

List<GridViewRowInfo> expandedGroups = new List<GridViewRowInfo>();

private void radGridView1_GroupExpanding(object sender, GroupExpandingEventArgs e)
{
    if (!e.IsExpanded && shouldCollapse)
    {
        expandedGroups.Add(e.DataGroup.GroupRow);
    }
}

bool shouldCollapse = false;

private void radButton1_Click(object sender, EventArgs e)
{
    shouldCollapse = true;
    items.Insert(0, new Item(2, "Test", "Type0"));
}

private void Rows_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e)
{
    if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Add)
    {
        this.radGridView1.CurrentRow = e.NewItems[0] as GridViewRowInfo;
        this.radGridView1.CurrentRow.IsSelected = true;
        GridViewRowInfo parent = this.radGridView1.CurrentRow.Parent as GridViewRowInfo;
        if (parent != null)
        {
            parent.IsExpanded = true;
        }

        if (shouldCollapse)
        {
            shouldCollapse = false;
            foreach (GridViewRowInfo r in expandedGroups)
            {
                if (!ContainsParentRow(parent, r))
                {
                    r.IsExpanded = false;
                }
            }
            expandedGroups.Clear();
        }
    }
}

private bool ContainsParentRow(GridViewRowInfo parent, GridViewRowInfo r)
{
    GridViewGroupRowInfo group = r as GridViewGroupRowInfo;
    if (group != null)
    {
        foreach (GridViewRowInfo childRow in group.ChildRows)
        {
            return ContainsParentRow(parent, childRow);
        }
    }

    return parent == r.Parent;
}
Completed
Last Updated: 15 Sep 2015 12:36 by ADMIN
Workaround: set up the templates from code, http://www.telerik.com/help/winforms/gridview-overview.html
Completed
Last Updated: 26 Jun 2015 12:19 by ADMIN
To reproduce:

1. Add a RadTreeView and a RadGridView 
2. Use the following code snippet.
3. Select a node from the RadtreeView.
4. Activate the editor for the new row in RadGridView.
5. While the grid editor is active, select a new node in the tree.

public Form1()
{
    InitializeComponent();
    this.radGridView1.MasterTemplate.AddNewBoundRowBeforeEdit = true;
}

public class ClassA 
{
    public int Id { get; set; }

    public string Name { get; set; }

    public string Grade { get; set; }
   
    public ClassA()
    {
    }

    public ClassA(int id, string name, string grade)
    {
        this.Id = id;
        this.Name = name;
        this.Grade = grade;
    }
}

public class ClassB
{
    public int NewID { get; set; }

    public string FirstName { get; set; }

    public string LastName { get; set; }

    public ClassB()
    {
    }

    public ClassB(int id, string firstName, string lastName)
    {
        this.NewID = id;
        this.FirstName = firstName;
        this.LastName = lastName;
    }
}

private void radTreeView1_SelectedNodeChanged(object sender, Telerik.WinControls.UI.RadTreeViewEventArgs e)
{
    if (radGridView1.DataSource is BindingList<ClassA>)
    { 
        this.radGridView1.Columns.Clear();
        this.radGridView1.DataSource = null;
        BindingList<ClassB> list = new BindingList<ClassB>() { new ClassB(1, "John", "Wick") };
        this.radGridView1.DataSource = list;
    }
    else
    {
        this.radGridView1.DataSource = null;
        BindingList<ClassA> list = new BindingList<ClassA>() { new ClassA(1,"John", "A+") };
        this.radGridView1.Columns.Clear();
        this.radGridView1.DataSource = list;
    }
}

Workaround:  this.radGridView1.MasterTemplate.AddNewBoundRowBeforeEdit = false;
Completed
Last Updated: 10 Jul 2015 14:42 by ADMIN
Workaround: create a custom GridCheckBoxHeaderCellElement and override the Attach method

public class MyGridCheckBoxHeaderCellElement : GridCheckBoxHeaderCellElement
{

	public MyGridCheckBoxHeaderCellElement(GridViewColumn column, GridRowElement row) : base(column, row)
	{
	}

	protected override Type ThemeEffectiveType {
		get { return typeof(GridHeaderCellElement); }
	}

	public override void Attach(GridViewColumn data, object context)
	{
		if (((GridViewCheckBoxColumn)data).EnableHeaderCheckBox) {
			base.Attach(data, context);
		} else {
			this.CheckBox.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
		}
	}
}

public Form1()
{
        InitializeComponent();
	this.radGridView1.CreateCell += radGridView1_CreateCell;
}


private void radGridView1_CreateCell(object sender, Telerik.WinControls.UI.GridViewCreateCellEventArgs e)
{
	if (e.CellType == typeof(GridCheckBoxHeaderCellElement)) {
		e.CellElement = new MyGridCheckBoxHeaderCellElement(e.Column, e.Row)
	}
}
Completed
Last Updated: 17 Aug 2015 10:06 by ADMIN
To reproduce:
private RadGridView radGridView1;

public Form1()
{
    InitializeComponent();
    radGridView1 = new RadGridView() { Dock = DockStyle.Fill };
    Controls.Add(radGridView1);

    List<Item> items = new List<Item>();
    for (int i = 0; i < 10; i++)
    {
        items.Add(new Item(i, "Item" + i, DateTime.Now.AddDays(i)));
    }
    radGridView1.AutoGenerateColumns = true;
    this.radGridView1.DataSource = items;
    this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
    this.radGridView1.EnableFiltering = true;

    this.radGridView1.CustomFiltering += radGridView1_CustomFiltering;
    radGridView1.EnableCustomFiltering = true;
}

void radGridView1_CustomFiltering(object sender, GridViewCustomFilteringEventArgs e)
{
    e.Handled = false;
    e.Visible = true;

    var item = (Item)e.Row.DataBoundItem;

    if (item == null)
        return;

    if (item.Name.EndsWith("Item"))
    {
        e.Handled = true;
        e.Visible = false;
    }
}

public class Item
{
    public int Id { get; set; }

    public string Name { get; set; }

    public Nullable<DateTime> Date { get; set; }

    public Item(int id, string name, Nullable<DateTime> date)
    {
        this.Id = id;
        this.Name = name;
        this.Date = date;
    }
}


Workaround:

private void radGridView1_CellEndEdit(object sender, GridViewCellEventArgs e)
{
    this.radGridView1.MasterTemplate.Refresh();
}
Completed
Last Updated: 13 Oct 2015 06:51 by ADMIN
To reproduce:
Me.RadGridView1.MultiSelect = True

Private Sub RadGridView1_CellFormatting(sender As Object, e As Telerik.WinControls.UI.CellFormattingEventArgs) _
Handles RadGridView1.CellFormatting
    If e.Row.IsSelected Then
        e.CellElement.BackColor = Color.LimeGreen
        e.CellElement.DrawFill = True
        e.CellElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid
    Else
        e.CellElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local)
        e.CellElement.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local)
        e.CellElement.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local)
    End If
End Sub

Step 1: Select a few rows with the mouse click in combination with the CTRL key.
Step 2: The rows are selected correctly and the desired green back color is applied. Release the CTRL Key.
Step 3: Click with the mouse on a different row in the grid.

Result: All previously selected rows but the last current row keep the green back color.

Workaround:

Sub New()
    InitializeComponent()
 
    Me.RadGridView1.MultiSelect = True
    AddHandler Me.RadGridView1.SelectionChanging, AddressOf SelectionChanging
    AddHandler Me.RadGridView1.SelectionChanged, AddressOf SelectionChanged
 
End Sub
 
Private Sub RadGridView1_CellFormatting(sender As Object, e As Telerik.WinControls.UI.CellFormattingEventArgs) _
Handles RadGridView1.CellFormatting
    e.CellElement.DrawFill = True
    e.CellElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid
    If e.Row.IsSelected Then
        e.CellElement.BackColor = Color.LimeGreen
    Else
        e.CellElement.BackColor = Color.Yellow
    End If
End Sub
Private Sub SelectionChanged(sender As Object, e As EventArgs)
    For Each r As GridViewRowInfo In selectedRows
        r.InvalidateRow()
    Next
    selectedRows.Clear()
End Sub
 
Dim selectedRows As New List(Of GridViewRowInfo)
Private Sub SelectionChanging(sender As Object, e As GridViewSelectionCancelEventArgs)
    For Each r As GridViewRowInfo In Me.RadGridView1.SelectedRows
        selectedRows.Add(r)
    Next
End Sub
Completed
Last Updated: 25 Jun 2015 12:35 by ADMIN
Completed
Last Updated: 07 Sep 2015 07:43 by ADMIN
To reproduce:

private void Form1_Load(object sender, EventArgs e)
{
    this.customersTableAdapter.Fill(this.nwindDataSet.Customers);

    this.radGridView1.DataSource = this.customersBindingSource;
    this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;

    foreach (GridViewColumn col in this.radGridView1.Columns)
    {
        col.MinWidth = 100;
    }
    
    ColumnGroupsViewDefinition view = new ColumnGroupsViewDefinition();
    view.ColumnGroups.Add(new GridViewColumnGroup("Customer Contact"));
    view.ColumnGroups.Add(new GridViewColumnGroup("Details"));
    view.ColumnGroups[1].Groups.Add(new GridViewColumnGroup("Address"));
    view.ColumnGroups[1].Groups.Add(new GridViewColumnGroup("Contact"));
    view.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow());
    view.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["CompanyName"]);
    view.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["ContactName"]);
    view.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["ContactTitle"]);

    view.ColumnGroups[1].Groups[0].Rows.Add(new GridViewColumnGroupRow());
    view.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["Address"]);
    view.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["City"]);
    view.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["Country"]);

    view.ColumnGroups[1].Groups[1].Rows.Add(new GridViewColumnGroupRow());
    view.ColumnGroups[1].Groups[1].Rows[0].Columns.Add(this.radGridView1.Columns["Phone"]);
    view.ColumnGroups[1].Groups[1].Rows[0].Columns.Add(this.radGridView1.Columns["Fax"]);
    radGridView1.ViewDefinition = view;
}

Please refer to the attached gif file illustrating the behavior when no ColumnGroupsViewDefinition is applied. The horizontal scroll-car should appear as well when the grid's width is less than the total MinWidth of all columns in case of ColumnGroupsViewDefinition.

Workaround: use GridViewAutoSizeColumnsMode.None and handle the RadGridView.SizeChanged event where you can adjust manually the Width of the visible columns on a way to simulate GridViewAutoSizeColumnsMode.Fill. Here is a sample approach:

private void Form1_Load(object sender, EventArgs e)
{
    this.customersTableAdapter.Fill(this.nwindDataSet.Customers);

    this.radGridView1.DataSource = this.customersBindingSource;
    this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.None;

    foreach (GridViewColumn col in this.radGridView1.Columns)
    {
        col.MinWidth = 100;
    }

    ColumnGroupsViewDefinition view = new ColumnGroupsViewDefinition();
    view.ColumnGroups.Add(new GridViewColumnGroup("Customer Contact"));
    view.ColumnGroups.Add(new GridViewColumnGroup("Details"));
    view.ColumnGroups[1].Groups.Add(new GridViewColumnGroup("Address"));
    view.ColumnGroups[1].Groups.Add(new GridViewColumnGroup("Contact"));
    view.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow());
    view.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["CompanyName"]);
    view.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["ContactName"]);
    view.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["ContactTitle"]);

    view.ColumnGroups[1].Groups[0].Rows.Add(new GridViewColumnGroupRow());
    view.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["Address"]);
    view.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["City"]);
    view.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["Country"]);

    view.ColumnGroups[1].Groups[1].Rows.Add(new GridViewColumnGroupRow());
    view.ColumnGroups[1].Groups[1].Rows[0].Columns.Add(this.radGridView1.Columns["Phone"]);
    view.ColumnGroups[1].Groups[1].Rows[0].Columns.Add(this.radGridView1.Columns["Fax"]);
    radGridView1.ViewDefinition = view;

    radGridView1.SizeChanged += radGridView1_SizeChanged;
}

private void radGridView1_SizeChanged(object sender, EventArgs e)
{
    int totalMinimumWidth = 0;
    int columnsCount = ColumnsCountWidth(out totalMinimumWidth);
    int delta = this.radGridView1.Width - totalMinimumWidth;
    AdjustColumnWidth(delta / columnsCount);
}

private void AdjustColumnWidth(int widthToAdd)
{
    ColumnGroupsViewDefinition view = this.radGridView1.ViewDefinition as ColumnGroupsViewDefinition;
    if (view == null)
    {
        return;
    }

    foreach (GridViewColumnGroup group in view.ColumnGroups)
    {
        AdjustColumnsInGroup(widthToAdd, group);
    }
}

private void AdjustColumnsInGroup(int widthToAdd, GridViewColumnGroup group)
{
    if (group.Groups.Count == 0)
    {
        foreach (GridViewColumnGroupRow row in group.Rows)
        {
            foreach (GridViewColumn col in row.Columns)
            {
                col.Width += widthToAdd;
            }
        }
    }
    else
    {
        foreach (GridViewColumnGroup g in group.Groups)
        {
            AdjustColumnsInGroup(widthToAdd, g);
        }
    }
}

private int ColumnsCountWidth(out int totalMinWidth)
{
    int columnsCount = 0;
    totalMinWidth = 0;
    ColumnGroupsViewDefinition view = this.radGridView1.ViewDefinition as ColumnGroupsViewDefinition;
    if (view == null)
    {
        return this.radGridView1.Columns.Count;
    }

    foreach (GridViewColumnGroup group in view.ColumnGroups)
    {
        columnsCount = IterateGroups(columnsCount, group, ref totalMinWidth);              
    }
    return columnsCount;
}

private static int IterateGroups(int columnsCount, GridViewColumnGroup group, ref int totalMinWidth)
{
    int count = columnsCount;
    if (group.Groups.Count == 0)
    {
        foreach (GridViewColumnGroupRow row in group.Rows)
        {
            count += row.Columns.Count;
            foreach (GridViewColumn col in row.Columns)
            {
                totalMinWidth += col.Width;
            }
        }
    }
    else
    {
        foreach (GridViewColumnGroup g in group.Groups)
        {
            count = IterateGroups(count, g, ref totalMinWidth);
        }
    }
    return count;
}
Completed
Last Updated: 14 Oct 2015 12:29 by ADMIN
Please refer to the attached screenshot.

Workaround: either select the RadGridView node in the Property Builder, or use the VS design time or control Smart Tag to set DataSource
Completed
Last Updated: 18 Jun 2015 10:37 by ADMIN
To reproduce :
- Set conditional formatting for all grid cells.
- Iterate all grid cells and set their value.

Workaround:
Use Begin/End update block.
Completed
Last Updated: 13 Oct 2015 10:28 by ADMIN
To reproduce:
- Add grid with several columns and set their AllowResize property to false.
- Set the FitWidthMode to FitPageWidth.
- Print the grid and you will notice that some of the columns are cut off.
 
Workaround:
- Set the AllowResize property to true before printing.
Completed
Last Updated: 13 Oct 2015 06:56 by ADMIN
To reproduce:
- Enter a value in the search row (make sure you will have several results)
- Enter a letter in the filtering row. The filetring row will lose the focus.

Workaround:
public class MyGridViewSearchRowInfo : GridViewSearchRowInfo
{
    public MyGridViewSearchRowInfo(GridViewInfo viewInfo) : base(viewInfo)
    {
    }

    public override void SelectNextSearchResult()
    {
        GridViewSystemRowInfo systemRow = this.ViewTemplate.MasterTemplate.CurrentRow as GridViewSystemRowInfo;

        if (systemRow != null && this.ViewTemplate.MasterTemplate.Owner.EditorManager.IsInEditMode)
        {
            return;
        }
        base.SelectNextSearchResult();
    }
}

//change the default row like this
void radGridView1_CreateRowInfo(object sender, GridViewCreateRowInfoEventArgs e)
{
    if (e.RowInfo is GridViewSearchRowInfo)
    {
        e.RowInfo = new MyGridViewSearchRowInfo(e.ViewInfo);
    }
}

Completed
Last Updated: 01 Jun 2015 11:12 by ADMIN
To reproduce: following the illustrated steps: http://screencast.com/t/D2TCpU2zo

Workaround: set up the hierarchy programmatically.
Completed
Last Updated: 15 Sep 2015 07:44 by ADMIN
To reproduce:

public Form1()
{
    InitializeComponent();

    GridViewCheckBoxColumn checkBoxColumn = new GridViewCheckBoxColumn("Select");
    checkBoxColumn.EnableHeaderCheckBox = true;
    radGridView1.MasterTemplate.Columns.Insert(0, checkBoxColumn);

    for (int i = 0; i < 10; i++)
    {
        this.radGridView1.Rows.Add(false);
    }
    this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;

    this.radGridView1.MultiSelect = true;
    this.radGridView1.HeaderCellToggleStateChanged += radGridView1_HeaderCellToggleStateChanged;
}

private void radGridView1_HeaderCellToggleStateChanged(object sender, GridViewHeaderCellEventArgs e)
{
    if (e.State.ToString() == "On")
        this.radGridView1.SelectAll();
    else
        this.radGridView1.ClearSelection();
}


Workaround 1:
private void radGridView1_HeaderCellToggleStateChanged(object sender, GridViewHeaderCellEventArgs e)
{
    bool selected = e.State.ToString() == "On";

    foreach (GridViewRowInfo r in this.radGridView1.Rows)
    {
        r.IsSelected = selected;
    }
}

Workaround 2:

private void radGridView1_MouseUp(object sender, MouseEventArgs e)
{
    RadCheckBoxElement el = this.radGridView1.ElementTree.GetElementAtPoint(e.Location) as RadCheckBoxElement;
    if (el!=null)
    {
        GridCheckBoxHeaderCellElement headerCell = el.Parent as GridCheckBoxHeaderCellElement;
        bool selected = el.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On;
        if (headerCell!=null)
        {
            if (selected)
            {
                this.radGridView1.SelectAll();
            }
            else
            {
                this.radGridView1.ClearSelection();
            }
        }
    }
}