Unplanned
Last Updated: 30 Mar 2016 07:55 by ADMIN
Description:
When you pin data rows from the child template to PinnedRowPosition.Top, it does not affect the row. However, when you pin the certain row to PinnedRowPosition.Bottom, the behavior is correct. The same issue is detected for the header rows from the child template.
Completed
Last Updated: 17 Aug 2015 08:22 by ADMIN
To reproduce:

Add a RadGridView and three GridViewComboBoxColumns with repetitive values:

for (int i = 0; i < 3; i++)
{
    List<int> datasource = new List<int>();
    for (int j = 0; j < 12; j++)
    {
        datasource.Add(j);
    }
    this.Grid.Columns.Add(new GridViewComboBoxColumn()
        {
            DataSource = datasource
        });
}

for (int i = 0; i < 10; i++)
{
    for (int j = 0; j < 5; j++)
    {
        this.Grid.Rows.Add(i, i, i);
    }
}

Start the project and sort second and last column by the same value and make sure that you have vertical scrollbar.

Select a cell in the second column change its value and press the tab key(or click on another cell in the same row). You will see that the scrollbar will go to the bottom of the grid.

Workaround:

Use the following class:

public class ActionExecuteHelper
    {
        #region Singleton

        private static ActionExecuteHelper instance;
        private static readonly object syncRoot = new object();

        public static ActionExecuteHelper Instance
        {
            get
            {
                if (instance == null)
                {
                    lock (syncRoot)
                    {
                        if (instance == null)
                        {
                            instance = new ActionExecuteHelper();
                        }
                    }
                }
                return instance;
            }
        }

        #endregion

        private readonly Timer timer;

        public ActionExecuteHelper()
        {
            this.timer = new Timer();
        }

        public void ExecuteDelayedAction(Action action, int delayInMilliseconds)
        {
            EventHandler timerTick = null;

            timerTick = delegate
            {
                this.timer.Stop();
                this.timer.Tick -= timerTick;
                action.Invoke();
            };

            this.timer.Tick += timerTick;
            this.timer.Interval = delayInMilliseconds;
            this.timer.Start();
        }
    }


And use it with the following code

private int savedValue;
private void Grid_CellEndEdit(object sender, GridViewCellEventArgs e)
{
    this.Grid.TableElement.VScrollBar.ValueChanged += ValueChangedDelegate;
}

private void ValueChangedDelegate(object sender, EventArgs e)
{
    this.Grid.TableElement.VScrollBar.ValueChanged -= ValueChangedDelegate;
    ActionExecuteHelper.Instance.ExecuteDelayedAction(new Action(this.SetScrollbarValue), 5);
}

private void SetScrollbarValue()
{
    this.Grid.TableElement.VScrollBar.Value = savedValue;
}

private void Grid_ValueChanging(object sender, ValueChangingEventArgs e)
{
    this.savedValue = this.Grid.TableElement.VScrollBar.Value;
}

This way the value of the scrollbar will be saved and restored.
Completed
Last Updated: 18 Mar 2014 07:11 by ADMIN
To reproduce:
- Set the AutoSizeRows and PrintGrouping properties to true.
- Add a group descriptor and then call the PrintPreview method of the grid.

Workaround:
- Use the following classes to create custom print style:
public class MyGridPrintRenderer : TableViewDefinitionPrintRenderer
{
    private RadGridView gridView;

    public MyGridPrintRenderer(RadGridView grid) : base(grid)
    {
        gridView = grid;
    }

    protected override int GetDataRowHeight(GridViewRowInfo row, TableViewRowLayoutBase rowLayout)
    {
        IVirtualizedElementProvider<GridViewRowInfo> rowElementProvider = this.gridView.TableElement.RowScroller.ElementProvider;
        GridRowElement visualRow = rowElementProvider.GetElement(row, null) as GridRowElement;
        if (visualRow is GridGroupHeaderRowElement)
        {
            return rowLayout.GetRowHeight(row);
        }
        return base.GetDataRowHeight(row, rowLayout);
    }
}

public class MyGridPrintSyle : GridPrintStyle
{
    protected override BaseGridPrintRenderer InitializePrintRenderer(RadGridView grid)
    {
        if (this.PrintRenderer != null)
        {
            this.PrintRenderer.PrintCellPaint -= renderer_PrintCellPaint;
            this.PrintRenderer.PrintCellFormatting -= renderer_PrintCellFormatting;
        }

        MyGridPrintRenderer renderer = new MyGridPrintRenderer(grid);

        renderer.PrintCellFormatting += renderer_PrintCellFormatting;
        renderer.PrintCellPaint += renderer_PrintCellPaint;

        return renderer;
    }

    private void renderer_PrintCellPaint(object sender, PrintCellPaintEventArgs e)
    {
        this.OnPrintCellPaint(sender, e);
    }

    private void renderer_PrintCellFormatting(object sender, PrintCellFormattingEventArgs e)
    {
        this.OnPrintCellFormatting(sender, e);
    }
}
Completed
Last Updated: 07 Apr 2014 14:09 by Ian Herbert
The binding source filtering should be synchronized with the grid one in case other controls are using the same binding source.
Completed
Last Updated: 05 Apr 2021 12:03 by ADMIN
Release R2 2021
The RadGridView designer allows you to add columns and make changes while debugging the application. When you click the Ok button it tells you that your changes cannot be applied and everything is lost. I've done this several times by accident and didn't realize I was debugging until my changes were lost. Maybe disallow making changes to the columns while debugging?
Completed
Last Updated: 02 Jul 2014 16:26 by ADMIN
To reproduce:
- Add some rows to a grid view and set the ClipboardCopyMode to EnableAlwaysIncludeHeaderText.
- Copy entire row and paste it in excel. You will notice that the columns are pasted right, but the cells values are merged.
- Also when multiple rows are copied the issue does not occur.
Completed
Last Updated: 01 Oct 2014 12:58 by ADMIN
To reproduce:


Create a form and add a timer with interval of 1 second and in tick handler do the following:


void t_Tick(object sender, EventArgs e)
{
    if (this.Controls.Count > 0)
    {
        Control oldGrid = this.Controls[0];
        this.Controls.RemoveAt(0);
        oldGrid.Dispose();




        GC.Collect(3, GCCollectionMode.Forced);
    }




    RadGridView grid = new RadGridView();
    grid.Dock = DockStyle.Fill;
    this.Controls.Add(grid);
}


You will see that the memory consumption will grow.


Workaround:


Use the following custom RadGridView


public class MyRadGridView : RadGridView
{
    protected override RadGridViewElement CreateGridViewElement()
    {
        return new MyElement();
    }
}


public class MyElement : RadGridViewElement
{
    protected override PagingPanelElement CreatePagingPanelElement()
    {
        return new MyPagingPanel();
    }


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


public class MyPagingPanel : PagingPanelElement
{
    protected override void CreateButtonsStripElementChildElements()
    {
        base.CreateButtonsStripElementChildElements();


        this.ButtonsStripElement.Children.Add(this.ButtonsStripElement.Grip);
        this.ButtonsStripElement.Children.Add(this.ButtonsStripElement.OverflowButton);


        this.ButtonsStripElement.Grip.Visibility = this.ButtonsStripElement.OverflowButton.Visibility = ElementVisibility.Collapsed;
    }


    protected override void CreateTextBoxStripElementChildElements()
    {
        base.CreateTextBoxStripElementChildElements();


        this.TextBoxStripElement.Children.Add(this.TextBoxStripElement.Grip);
        this.TextBoxStripElement.Children.Add(this.TextBoxStripElement.OverflowButton);


        this.TextBoxStripElement.Grip.Visibility = this.TextBoxStripElement.OverflowButton.Visibility = ElementVisibility.Collapsed;
    }
}
Completed
Last Updated: 01 Oct 2014 12:58 by ADMIN
This issue appears when one clears the relations collection of RadGridView, it appears sporadically and in rare cases
Completed
Last Updated: 11 Nov 2015 11:36 by ADMIN
To reproduce:
1.Add a GridViewCheckBoxColumn and populate the grid with data:
radGridView1.DataSource = Enumerable.Range(1, 100).Select(i => new { Check = i % 2 == 0});
2.Add a RadButton and on its Click event clear the filters:
private void radButton1_Click(object sender, EventArgs e)
{
    radGridView1.MasterTemplate.FilterDescriptors.Clear();
}
3.Run the application and change the filter to show only checked items. Then click the button. The check box in the filtering row for GridViewCheckBoxColumn was not updated properly.

Workaround:
this.radGridView1.BeginUpdate();
radGridView1.MasterTemplate.FilterDescriptors.Clear();
this.radGridView1.EndUpdate();
Declined
Last Updated: 01 Oct 2014 12:58 by ADMIN
DECLINED: this happens only when the double click is outside the bounds of the scroll button which is the expected behavior.

To reproduce: When the user clicks too fast on the quite thin area between the grid's scroll-bar arrow button and the row, it fires the CurrentRowChanging event.

Workaround:
private bool cancelChanging = false;

private void radGridView1_CurrentRowChanging(object sender, CurrentRowChangingEventArgs e)
{
if (cancelChanging)
{
e.Cancel = true;
cancelChanging = false;
}
}

private void radGridView1_MouseDoubleClick(object sender, MouseEventArgs e)
{
cancelChanging = false;

RadElement element = this.radGridView1.Behavior.GetHoveredRadElement();

while (element != null)
{
if (element.GetType() == typeof(RadScrollBarElement))
{
cancelChanging = true;
break;
}
element = element.Parent;
}
}
Completed
Last Updated: 01 Oct 2014 12:59 by ADMIN
ADMIN
Created by: Dess | Tech Support Engineer, Principal
Comments: 1
Category: GridView
Type: Bug Report
0
Steps at design time:
1.Add a RadGridView to the from and change its Dock property to Fill.
2.Change its AutoSizeColumnsMode property to Fill.
3.Chage the Form.Size property to Width = 527 and Height = 346.

Use the following code:
public Form1()
{
    InitializeComponent();

    DataTable dt = new DataTable("Items");

    dt.Columns.Add("Id", typeof(int));
    dt.Columns.Add("Description", typeof(string));
    dt.Columns.Add("Price", typeof(decimal));
    dt.Columns.Add("Supplier", typeof(string));

    for (int i = 0; i < 10; i++)
    {
        dt.Rows.Add(i, "Description" + i, i * 0.25, "Supplier" + i);
    }

    radGridView1.DataSource = dt;
}

Workaround: set the AutoSizeColumnsMode property to Fill in the Form.Load event:
private void Form1_Load(object sender, EventArgs e)
{
    radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
}
Completed
Last Updated: 04 Jul 2014 11:55 by ADMIN
To reproduce:
public Form1()
{
    InitializeComponent();

    for (int i = 0; i < 10; i++)
    {
        this.radGridView1.Columns.Add("Col" + i);
    }

    for (int i = 0; i < 8000; i++)
    {
        GridViewRowInfo row = radGridView1.Rows.NewRow();
        foreach (GridViewCellInfo cell in row.Cells)
        {
            cell.Value = "Data" + row.Index + "." + cell.ColumnInfo.Index;
        }
        radGridView1.Rows.Add(row);
    }
    GridViewTemplate childTemplate = CreateChildTemplate();
    this.radGridView1.Templates.Add(childTemplate);

    childTemplate.HierarchyDataProvider = new GridViewEventDataProvider(childTemplate);
    this.radGridView1.RowSourceNeeded += radGridView1_RowSourceNeeded;
}

private void radGridView1_RowSourceNeeded(object sender, GridViewRowSourceNeededEventArgs e)
{
    for (int i = 0; i < 10; i++)
    {
        GridViewRowInfo row = e.Template.Rows.NewRow();
        row.Cells["Name"].Value = "Name" + i;
        row.Cells["ProductNumber"].Value = "ProductNumber" + i;

        e.SourceCollection.Add(row);
    }
}

private GridViewTemplate CreateChildTemplate()
{
    GridViewTemplate template = new GridViewTemplate();
    template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;

    GridViewTextBoxColumn namecolumn = new GridViewTextBoxColumn("Name");
    GridViewTextBoxColumn productNumberColumn = new GridViewTextBoxColumn("ProductNumber");
    template.Columns.AddRange(namecolumn,
        productNumberColumn);

    return template;
}

private void radButton1_Click(object sender, EventArgs e)
{
     this.radGridView1.GridNavigator.SelectLastRow();
}

Workaround: navigate the vertical scrollbar to the last row before calling the SelectLastRow method:

private void radButton1_Click(object sender, EventArgs e)
{
    this.radGridView1.TableElement.RowScroller.Scrollbar.PerformLast();
    this.radGridView1.GridNavigator.SelectLastRow();
}
Declined
Last Updated: 01 Oct 2014 12:58 by ADMIN
Setting the DataSource is slower (about 1/3 times more)  when ShowColumnHeaders is set to true. Workaround: 

Set the ShowColumnHeaders to false, then set the DataSource and restore the ShowColumnHeaders state:

radGridView1.ShowColumnHeaders = false;
radGridView1.DataSource =  mySource;
radGridView1.ShowColumnHeaders = true;
Completed
Last Updated: 01 Oct 2014 13:12 by ADMIN
By design the  MinHeight property is not respected in ColumnGroupsViewDefinition.

The right way to apply MinHeight in the ColumnGroupsViewDefinition is setting the GridViewColumnGroup's RowSpanProperty and GridViewColumnGroupRow's MinHeight property. For example:

            this.columnGroupsView = new ColumnGroupsViewDefinition();
            this.columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup("General") { RowSpan = 40 });
            this.columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup("Details") { RowSpan = 40 });
            this.columnGroupsView.ColumnGroups[1].Groups.Add(new GridViewColumnGroup("Address") { RowSpan = 40 });
            this.columnGroupsView.ColumnGroups[1].Groups.Add(new GridViewColumnGroup("Ime Tam") { RowSpan = 40 });
            this.columnGroupsView.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow() { MinHeight = 40 });             
            this.columnGroupsView.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow() { MinHeight = 40 });
            this.radGridView1.Columns["ContactName"].RowSpan = 40;
            this.columnGroupsView.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["CustomerID"]);
            this.columnGroupsView.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["ContactName"]);         
            this.columnGroupsView.ColumnGroups[0].Rows[1].Columns.Add(this.radGridView1.Columns["CompanyName"]);
            this.columnGroupsView.ColumnGroups[1].Groups[0].Rows.Add(new GridViewColumnGroupRow() { MinHeight = 40 });             
            this.columnGroupsView.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["City"]);             
            this.columnGroupsView.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["Country"]);
            this.columnGroupsView.ColumnGroups[1].Groups[1].Rows.Add(new GridViewColumnGroupRow() { MinHeight = 40 });          
            this.columnGroupsView.ColumnGroups[1].Groups[1].Rows[0].Columns.Add(this.radGridView1.Columns["Phone"]);
Completed
Last Updated: 07 Dec 2015 10:53 by ADMIN
To reproduce:
-Add a RadGridView and use the following code snippet:

 public Form1()
 {
     InitializeComponent();

      //add GridViewCheckBoxColumn with DataType to BOOL
     GridViewCheckBoxColumn autoTestingselectColumn = new GridViewCheckBoxColumn();
     autoTestingselectColumn.DataType = typeof(bool);
     autoTestingselectColumn.Name = "AutomatedTestingSelectColumn";
     autoTestingselectColumn.FieldName = "AutomatedTestingSelectColumn";
     autoTestingselectColumn.HeaderText = "Automated Testing Select";
     radGridView1.MasterTemplate.Columns.Add(autoTestingselectColumn);

     //add GridViewCheckBoxColumn with DataType to INT
     GridViewCheckBoxColumn startTestingColumn = new GridViewCheckBoxColumn();
     startTestingColumn.DataType = typeof(int);
     startTestingColumn.Name = "StartTestingColumn";
     startTestingColumn.FieldName = "StartTestingColumn";
     startTestingColumn.HeaderText = "StartTesting";
     radGridView1.MasterTemplate.Columns.Add(startTestingColumn);

     List<Item> items = new List<Item>();
     for (int i = 0; i < 5; i++)
     {
         items.Add(new Item(Guid.NewGuid().ToString(),"Name"+i));
     }

     this.radGridView1.DataSource = items;
      //set the AutoSizeColumnsMode property to Fill
     this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
 }

 public class Item
 {
     public string UniqueIdentifier { get; set; }
     public string Name { get; set; }
     public Item(string uniqueIdentifier, string name)
     {
         this.UniqueIdentifier = uniqueIdentifier;
         this.Name = name;
     }
 }

-Run the project. As a result 4 columns are displayed: two programmatically added and two coming from the data source.
-Now open the Property Builder at design time and add a GridViewCheckBoxColumn.
-Run the project. As a result, 5 columns are displayed: one added at design time, two programmatically added, two coming from the data source.
-Open the Property Builder again and delete the GridViewCheckBoxColumn.
-Run the project. You will notice that only two columns are displayed. The columns, coming from the data source are not generated.

Workaround: delete columns using the Columns collection at design time, instead of using the property Builder.
Declined
Last Updated: 06 Feb 2018 06:40 by ADMIN
To reproduce:
- Add a RadGridView and a button to a blank form.
- Subscribe to CellValidating event from the grid and set the cancel property of the CellValidatingEventArgs to true upon some condition.
- Add click event handler for the button and print a message in it.
- Start the application and enter some invalid data in the grid cell, then click the button.
- The code from the button's event handler is executed.

Workaround use a flag to determine when to execute the corresponding button code:
bool validating = false;

void radGridView1_CellValidating(object sender, Telerik.WinControls.UI.CellValidatingEventArgs e)
{
    if (e.Value.ToString().Length < 5)
    {
        e.Cancel = true;
        validating = true;
        e.Row.ErrorText = "Validation error!";
    }
    else
    {
        validating = false;
    }
}

private void radButton1_Click(object sender, EventArgs e)
{
    if (!validating)
    {
        Debug.WriteLine("Executed");
    }
}


Declined
Last Updated: 21 Oct 2015 08:38 by ADMIN
To reproduce:
- Add grid with a DateTime column with default value "5/1/2014";
- Start the app and press the following keys one after another: 5/1/
- You will notice that the "1" is not replaced.

Please note that the similar behavior occur when the year is entered (it does not match the default one). 

Workaround handle the key press for such cases manually:

void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    RadDateTimeEditor ed = e.ActiveEditor as RadDateTimeEditor;
    
    RadDateTimeEditorElement el = ed.EditorElement as RadDateTimeEditorElement;
    el.KeyPress += el_KeyPress;
}

private void el_KeyPress(object sender, KeyPressEventArgs e)
{
	RadDateTimeEditorElement el = (RadDateTimeEditorElement)sender;
	int day = el.Value.Value.Day;
	int key = -1;
	int.TryParse(e.KeyChar.ToString(), key);

	RadMaskedEditBoxElement element = el.TextBoxElement.TextBoxItem.Parent as RadMaskedEditBoxElement;
	MaskDateTimeProvider provider = element.Provider as MaskDateTimeProvider;

	if (provider.SelectedItemIndex == 2) {
		if (key > 0 & key <= 9) {
			if (el.TextBoxElement.TextBoxItem.SelectionLength != 0) {
				if (!booKeying) {
					dynamic NewValue = new DateTime(el.Value.Value.Year, el.Value.Value.Month, key);
					el.Value = NewValue;
					e.Handled = true;
					booKeying = true;
				}
			}
		}
	}
}
Completed
Last Updated: 13 Jun 2014 12:41 by ADMIN
To reproduce:
- Filer twice by a single column with Excel-like filtering.
- The second time InvalidCastException will occur.

Workaround:
- Create custom columns and override the GetDistinctValues method.

public class MyColumn : GridViewTextBoxColumn
{
    protected override GridViewColumnValuesCollection GetDistinctValues()
    {
        int index = this.Index;

        if (index >= 0)
        {
            GridViewColumnValuesCollection distinctValues = new GridViewColumnValuesCollection();
            foreach (GridViewRowInfo row in this.OwnerTemplate.Rows)
            {
               
                object cellValue = row.Cells[index].Value;
                if (!distinctValues.Contains(cellValue))
                {
                    distinctValues.Add(cellValue);
                }
            }
            if (distinctValues.Count > 0)
            {
                return distinctValues;
            }
        }

        return null;
    }
}

Completed
Last Updated: 30 May 2014 08:39 by ADMIN
Workaround: the MasterTemplate has Copy method, which allows overriding in its descendants. Thus, it is possible to modify the copied data according to the specific requirements:

public class CustomGrid : RadGridView
{
    protected override RadGridViewElement CreateGridViewElement()
    {
        return new CustomRadGridViewElement();
    }

    public override string ThemeClassName 
    {
        get
        {
            return typeof(RadGridView).FullName; 
        }
    }
}

public class CustomRadGridViewElement : RadGridViewElement
{
    protected override MasterGridViewTemplate CreateTemplate()
    {
        return new CustomMasterGridViewTemplate();
    }
    
    protected override Type ThemeEffectiveType    
    {
        get   
        {
            return typeof(RadGridViewElement);    
        }
    }
}

public class CustomMasterGridViewTemplate : MasterGridViewTemplate
{
    public override void Copy()
    {
        base.Copy();
 
        if (Clipboard.ContainsData(DataFormats.Text))
        {
            string data = Clipboard.GetData(DataFormats.Text).ToString();
     
            if (data != string.Empty)
            {
                StringBuilder sb = new StringBuilder(data);
                //modify the copied data and replace it in the clipboard
                Clipboard.SetData(DataFormats.Text, sb.ToString());
            }
        }
    }
}