1. Create a new project with RadGridView and setup 4 level hierarchy. 2. Add a button and handle its Click event. 3. In the Click event handler expand all rows. Surround the code with calls to Begin/EndUpdate methods of RadGridView or GridViewTemplate. 4. Run the application and click the button. Workaround use the Begin.EndUpdate method of the TableElement, not the grid control
To reproduce : add a GridViewMultiComboBoxColumn and use the following code snippet: Private Sub RadGridView1_CellEditorInitialized(sender As Object, e As GridViewCellEventArgs) Handles RadGridView1.CellEditorInitialized Dim multiComboElement As RadMultiColumnComboBoxElement = TryCast(Me.RadGridView1.ActiveEditor, RadMultiColumnComboBoxElement) If multiComboElement IsNot Nothing Then multiComboElement.AutoFilter = True If multiComboElement.EditorControl.MasterTemplate.FilterDescriptors.Count = 0 Then Dim autoFilter As New FilterDescriptor autoFilter.PropertyName = multiComboElement.DisplayMember autoFilter.Operator = FilterOperator.StartsWith multiComboElement.EditorControl.MasterTemplate.FilterDescriptors.Add(autoFilter) multiComboElement.SelectedIndex = -1 multiComboElement.DropDownHeight = 200 multiComboElement.DropDownWidth = 800 multiComboElement.EditorControl.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill End If End If End Sub The attached gif file illustrates the behavior.
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.
When a mask is set to a GridViewMaskBoxColumn and string is applied as value, the visual element will show only the string without the mask literals. E.g. mask is set to ####/# and value is set to string "11112" the view will be 11112 instead of 1111/2. Ways to achieve this: 1. Use CellFormatting. 2. Use a custom type converter: Example of a custom TypeConverter could be seen from the following feedback item: http://feedback.telerik.com/Project/154/Feedback/Details/112463-fix-radgridview-the-textmaskformat-property-of-gridviewmaskboxcolumn-is-not-ta
To reproduce: public Form1() { InitializeComponent(); this.radGridView1.Columns.Add("Col1"); this.radGridView1.Rows.Add("word \u00AD word"); this.radGridView1.Rows.Add("word - word"); } Workaround: replace "\u00AD" with "-" private void radGridView1_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e) { e.CellElement.Text = e.CellElement.Text.Replace("\u00AD", "-"); }
To reproduce: 1. Drag a grid from the Toolbox and drop it onto the form 2. Open the designer 3. Set the RadGridView.AutoGenerateHierarchy property to true. 4. Open the smart tag and set the DataSource property. As a result the grid templates and relations will be created. 5. Try to open the Property Builder. It opens successfully. 6. Close the Property Builder and add a new templated from the smart tag. 7. If you try to open the Property Builder again you will obtain the error. Please refer o the attached gif file illustrating the behavior. Workaround: set the AutoGenerateHierarchy to false in order to open the Property Builder.
Workaround: check the attached project
Workaround: List<object> list = new List<object>(array); this.radGridView1.DataSource = list;
The ActiveEditor property of the event arguments of the CellEndEdit event always returns null. The property should be either removed or made return proper data.
1 .Add RadgridView to Form 2. Set "AllowSearchRow" property to True 3. Add a row and place the word "Gießen" (name of a city) in a column 4. When the program is running type "Giessen" in the AutoSearch Row. After the "n" an ArgumentException is thrown.
To reproduce: - Enable the alternating row color and change the current cell as fast as you can. Workaround: void radGridView1_RowFormatting(object sender, RowFormattingEventArgs e) { if (e.RowElement.RowInfo.Index %2 ==0) { e.RowElement.DrawFill = true; e.RowElement.GradientStyle = GradientStyles.Solid; e.RowElement.BackColor = Color.Aqua; } else { e.RowElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local); e.RowElement.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local); e.RowElement.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local); } }
To reproduce: use DataAccess to connect to Northwind.Customer table: public Form1() { InitializeComponent(); EntitiesModel1 context = new EntitiesModel1(); var query = (from c in context.Customers where c.CustomerID.Contains("f") select c).ToList(); this.radGridView1.DataSource = query; SortDescriptor descriptor = new SortDescriptor(); descriptor.PropertyName = "CustomerID"; descriptor.Direction = ListSortDirection.Ascending; this.radGridView1.MasterTemplate.SortDescriptors.Add(descriptor); this.radGridView1.CurrentRow = this.radGridView1.Rows.Last(); } Run the project and press the Delete key several times. Workaround: use BindingSource as RadGridView.DataSource: BindingSource bs = new BindingSource(); bs.DataSource = query; this.radGridView1.DataSource = bs;
1. Create a new project and open a form at design mode. 2. Drop RadGridView component on the form. 3. Bind it to some data source. 4. Open the property builder. 5. Select a column and change its name property. You will see that the column name remains the same in the columns list located at left.
To reproduce: GridViewHyperlinkColumn col = new GridViewHyperlinkColumn(); col.FieldName = "Name"; col.HyperlinkOpenAction = HyperlinkOpenAction.DoubleClick; Workaround: Use the CellDoubleClick event: void radGridView1_CellDoubleClick(object sender, GridViewCellEventArgs e) { if (e.Column is GridViewHyperlinkColumn) { string hyperlink = e.Value.ToString(); } }
How to reproduce: public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radGridView1.DataSource = this.GetData(); this.Load += Form1_Load; } private void Form1_Load(object sender, EventArgs e) { this.radGridView1.SynchronizeCurrentRowInSplitMode = true; this.radGridView1.SplitMode = Telerik.WinControls.UI.RadGridViewSplitMode.Vertical; } private DataTable GetData() { DataTable dt = new DataTable(); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Age", typeof(int)); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("Bool", typeof(bool)); for (int i = 0; i < 100; i++) { dt.Rows.Add("Name " + i, i, DateTime.Now.AddMinutes(i), i % 2 == 0 ? true : false); } return dt; } } Workaround: public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radGridView1.DataSource = this.GetData(); this.radGridView1.ViewDefinition = new SplitViewDefintion(); this.Load += Form1_Load; } private void Form1_Load(object sender, EventArgs e) { this.radGridView1.SynchronizeCurrentRowInSplitMode = true; this.radGridView1.SplitMode = Telerik.WinControls.UI.RadGridViewSplitMode.Vertical; } private DataTable GetData() { DataTable dt = new DataTable(); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Age", typeof(int)); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("Bool", typeof(bool)); for (int i = 0; i < 100; i++) { dt.Rows.Add("Name " + i, i, DateTime.Now.AddMinutes(i), i % 2 == 0 ? true : false); } return dt; } } public class SplitViewDefintion : TableViewDefinition { public override IRowView CreateViewUIElement(GridViewInfo viewInfo) { return new MyGridTableElement(); } } public class MyGridTableElement : GridTableElement { protected override RadScrollBarElement CreateScrollBarElement() { return new MyRadScrollbarElement(); } } public class MyRadScrollbarElement : RadScrollBarElement { protected override Type ThemeEffectiveType { get { return typeof(RadScrollBarElement); } } protected override void OnMouseDown(MouseEventArgs e) { if (Cursor.Current == Cursors.SizeWE || Cursor.Current == Cursors.SizeNS) { return; } base.OnMouseDown(e); } }
To reproduce: 1. Bind RadGridView to a collection of business objects where one of the properties is Nullable<DateTime>. 2. Leave one of the items with an empty date (null value). 3. Copy the entire row and try to paste in one of the grid rows. The FormatException is thrown. Sub New() InitializeComponent() Dim items As New List(Of Item) items.Add(New Item(1, DateTime.Now.AddDays(2), "Item1")) items.Add(New Item(2, Nothing, "Item2")) items.Add(New Item(3, DateTime.Now.AddDays(4), "Item3")) items.Add(New Item(4, DateTime.Now.AddDays(5), "Item4")) Me.RadGridView1.DataSource = items Me.RadGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill End Sub Public Class Item Private _id As Integer Private _createdOn As Nullable(Of DateTime) Private _title As String Public Sub New(id As Integer, createdOn As Nullable(Of DateTime), title As String) Me._id = id Me._createdOn = createdOn Me._title = title End Sub Public Property Id() As Integer Get Return _id End Get Set(ByVal value As Integer) _id = value End Set End Property Public Property CreatedOn() As Nullable(Of DateTime) Get Return _createdOn End Get Set(ByVal value As Nullable(Of DateTime)) _createdOn = value End Set End Property Public Property Title() As String Get Return _title End Get Set(ByVal value As String) _title = value End Set End Property End Class Workaround: use a TypeConverter Sub New() InitializeComponent() Dim items As New List(Of Item) items.Add(New Item(1, DateTime.Now.AddDays(2), "Item1")) items.Add(New Item(2, Nothing, "Item2")) items.Add(New Item(3, DateTime.Now.AddDays(4), "Item3")) items.Add(New Item(4, DateTime.Now.AddDays(5), "Item4")) Me.RadGridView1.DataSource = items Me.RadGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill DirectCast(Me.RadGridView1.Columns(1), GridViewDateTimeColumn).DataTypeConverter=New NullableDateTimeConverter() End Sub Public Class NullableDateTimeConverter Inherits TypeConverter Public Overrides Function CanConvertFrom(ByVal context As ITypeDescriptorContext, ByVal sourceType As Type) As Boolean Return sourceType.Equals(GetType(String)) End Function Public Overrides Function ConvertFrom(ByVal context As ITypeDescriptorContext, ByVal culture As CultureInfo, ByVal value As Object) As Object Dim parsedDate As DateTime If DateTime.TryParse(value.ToString(), parsedDate) Then Return parsedDate End If Return Nothing End Function End Class Public Class Item Private _id As Integer Private _createdOn As Nullable(Of DateTime) Private _title As String Public Sub New(id As Integer, createdOn As Nullable(Of DateTime), title As String) Me._id = id Me._createdOn = createdOn Me._title = title End Sub Public Property Id() As Integer Get Return _id End Get Set(ByVal value As Integer) _id = value End Set End Property Public Property CreatedOn() As Nullable(Of DateTime) Get Return _createdOn End Get Set(ByVal value As Nullable(Of DateTime)) _createdOn = value End Set End Property Public Property Title() As String Get Return _title End Get Set(ByVal value As String) _title = value End Set End Property End Class
After a couple clicks, grid's context menu becomes unresponsive when using RadGridView through remote connection and Windows 7
The events are fired in the following order: UserAddingRow, EditorRequired, UserAddedRow eventfired when the new is pinned at the bottom and TAB key is processed. Workaround: public class FixGridNewRowBehavior : GridNewRowBehavior { protected override bool ProcessTabKey(System.Windows.Forms.KeyEventArgs keys) { bool isInEditMode = this.EditorManager.IsInEditMode; if (isInEditMode) { IGridNavigator navigator = GridViewElement.Navigator; bool isLeftNavigation = navigator.IsFirstColumn(GridViewElement.CurrentColumn) && keys.Shift; bool isRightNavigation = navigator.IsLastColumn(GridViewElement.CurrentColumn) && !keys.Shift; if (isLeftNavigation || isRightNavigation) { this.GridViewElement.EndEdit(); } if (isLeftNavigation) { navigator.SelectLastColumn(); } else if (isRightNavigation) { navigator.SelectFirstColumn(); } if (isLeftNavigation || isRightNavigation) { GridViewElement.BeginEdit(); return true; } } return base.ProcessTabKey(keys); } } BaseGridBehavior gridBehavior = this.radGridView1.GridBehavior as BaseGridBehavior; gridBehavior.UnregisterBehavior(typeof(GridViewNewRowInfo)); gridBehavior.RegisterBehavior(typeof(GridViewNewRowInfo), new FixGridNewRowBehavior());
To reproduce: Sub New() InitializeComponent() Dim dt As New DataTable() dt.Columns.Add("Name", GetType(String)) dt.Columns.Add("Price", GetType(Decimal)) dt.Columns.Add("Id", GetType(Integer)) dt.Columns.Add("ActivatedOn", GetType(DateTime)) For i As Integer = 0 To 4 dt.Rows.Add("Item" & i, i * 0.25, i, DateTime.Now.AddHours(i)) Next Me.RadGridView1.DataSource = dt Me.RadGridView1.Columns("Id").[ReadOnly] = True Me.RadGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill AddHandler Me.RadGridView1.DefaultValuesNeeded, AddressOf radGridView1_DefaultValuesNeeded Me.RadGridView1.NewRowEnterKeyMode = RadGridViewNewRowEnterKeyMode.EnterMovesToLastAddedRow End Sub Private Sub radGridView1_DefaultValuesNeeded(sender As Object, e As GridViewRowEventArgs) e.Row.Cells("Id").Value = Me.radGridView1.Rows.Count e.Row.Cells("ActivatedOn").Value = DateTime.Now End Sub Select the read-only cell inside the new row and press Enter. You will notice that two duplicated rows are added. Workaround: handle the RadGridView.PreviewKeyDown event and change the current column to one that is not read-only AddHandler Me.RadGridView1.PreviewKeyDown, AddressOf GridPreviewKeyDown Private Sub GridPreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) If e.KeyCode = Keys.Enter Then Me.RadGridView1.CurrentColumn = Me.RadGridView1.Columns(0) Me.RadGridView1.BeginEdit() End If End Sub