To reproduce: Private _createDataTable As Object Private _BoxValue As String Sub New() InitializeComponent() RelCalculateValues() Me.RadGridView1.BestFitColumns(Telerik.WinControls.UI.BestFitColumnMode.AllCells) End Sub Private Sub RadGridView1_CellEndEdit(sender As Object, e As GridViewCellEventArgs) _ Handles RadGridView1.CellEndEdit If e.RowIndex < 0 OrElse e.ColumnIndex < 0 Then Exit Sub If e.Value = _BoxValue Then Exit Sub If e.Column.Name <> "AllowedWane" Then Exit Sub Dim fTester As Decimal Dim rRow As Telerik.WinControls.UI.GridViewDataRowInfo = e.Row Dim iRowID As Int32 iRowID = rRow.Cells("ID").Value If iRowID < 0 Then Exit Sub Select Case e.Column.Name Case "AllowedWane" If Decimal.TryParse(e.Value, fTester) = False Then rRow.Cells(e.Column.Name).Value = _BoxValue Exit Sub Else Select Case e.Column.OwnerTemplate.MasterTemplate.Owner.Name Case RadGridView1.Name RelCalculateValues(Me.RadGridView1) End Select End If End Select End Sub Private Sub RelCalculateValues(ByVal rgvAsete As Telerik.WinControls.UI.RadGridView) Dim dtJakauma As New DataTable Dim drJakauma As DataRow dtJakauma.Columns.Add("ID", GetType(Int32)) dtJakauma.Columns.Add("Dimensions", GetType(String)) dtJakauma.Columns.Add("Pcs", GetType(String)) dtJakauma.Columns.Add("Percents", GetType(String)) dtJakauma.Columns.Add("Price", GetType(String)) dtJakauma.Columns.Add("UsageFactor", GetType(String)) dtJakauma.Columns.Add("CubicMeters", GetType(String)) dtJakauma.Columns.Add("EdgeLimit", GetType(String)) dtJakauma.Columns.Add("AllowedWane", GetType(String)) dtJakauma.Columns.Add("Length", GetType(String)) For i As Int32 = 0 To 5 drJakauma = dtJakauma.NewRow drJakauma("ID") = 0 drJakauma("Dimensions") = "Dimensions_" & i drJakauma("Pcs") = "Pcs_" & i drJakauma("Percents") = "Percents_" & i drJakauma("Price") = "Price_" & i drJakauma("UsageFactor") = "UsageFactor_" & i drJakauma("CubicMeters") = "CubicMeters_" & i drJakauma("EdgeLimit") = "EdgeLimit_" & i drJakauma("AllowedWane") = "AllowedWane_" & i drJakauma("Length") = "Length_" & i dtJakauma.Rows.Add(drJakauma) Next rgvAsete.DataSource = dtJakauma rgvAsete.BestFitColumns(Telerik.WinControls.UI.BestFitColumnMode.AllCells) End Sub Workaround: set the RadGridView.DataSource to null/Nothing before setting it to the new DataTable.
To reproduce set AddNewRowPosition is Bottom and the NewRowEnterKeyMode is EnterMovesToNextCell and add a new row via na UI Workaround: void radGridView1_RowsChanged(object sender, GridViewCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add && radGridView1.CurrentRow is GridViewNewRowInfo) { } }
To reproduce: 1. Add a RadGridView and a RadButton. 2. Enable paging. 3. Use the code snippet below: private void Form1_Load(object sender, EventArgs e) { this.ordersTableAdapter.Fill(this.nwindDataSet.Orders); bs.DataSource = this.ordersBindingSource; this.radGridView1.DataSource = bs; } BindingSource bs = new BindingSource(); private void radButton1_Click(object sender, EventArgs e) { bs.Filter ="ShipName LIKE '%z%'"; } 4. Navigate to page 80 and click the button. 5. You have only 4 pages available , but you are still positioned on page 80. Workaround: private void radButton1_Click(object sender, EventArgs e) { bs.Filter ="ShipName LIKE '%z%'"; if (this.radGridView1.MasterTemplate.PageIndex>this.radGridView1.MasterTemplate.TotalPages) { this.radGridView1.MasterTemplate.MoveToFirstPage(); } }
To reproduce: Add a RadGridView with some data and enable the paging functionality. Also set the AutoSize property to true: grid.EnablePaging = true; grid.AutoSize = true; Start the application and you will see that when you try to edit the textbox with the number of the page you will not be able to. Workaround: Set the AutoSize property to false and use MinimumSize instead: grid.AutoSize = false; grid.MinimumSize = new Size(600, 500);
To reproduce: DataTable dt = new DataTable(); public Form1() { InitializeComponent(); this.radGridView1.EnableFiltering = true; this.radGridView1.ShowHeaderCellButtons = true; this.radGridView1.Relations.AddSelfReference(this.radGridView1.MasterTemplate, "ID", "ParentID"); dt.Columns.Add("ID", typeof(int)); dt.Columns.Add("Title", typeof(string)); dt.Columns.Add("ParentID", typeof(int)); for (int i = 1; i <= 5; i++) { dt.Rows.Add(i, "Parent." + i, 0); } Random rand = new Random(); for (int i = 6; i < 20; i++) { dt.Rows.Add(i, "Child." + i, rand.Next(1, 6)); } for (int i = 20; i < 40; i++) { dt.Rows.Add(i, "SubChild." + i, rand.Next(6, 20)); } this.radGridView1.DataSource = dt; this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; }
Customize the default DateTime filtering in order to allow scenarios, when the end users enters both date and time part, or only time and filter is applied based on the chosen criteria.
To reproduce: Create a self reference RadGridView and add enough columns so that a horizontal scrollbar appears. Scroll the horizontal scrollbar to the right and close the form. You will see an exception. Workaround: Create a custom row element in the CreateRow event: void radGridView1_CreateRow(object sender, Telerik.WinControls.UI.GridViewCreateRowEventArgs e) { if (e.RowInfo is GridViewHierarchyRowInfo || e.RowInfo is GridViewDataRowInfo) { e.RowElement = new MyDataRowElement(); } } public class MyLayout : SelfReferenceCellLayout { public MyLayout(GridRowElement rowElement) : base(rowElement) { } public override void DetachCellElements() { if (this.StackLayoutElement != null) { base.DetachCellElements(); } } } public class MyDataRowElement : GridDataRowElement { private MyLayout cellReferenceLayout; public override void Detach() { base.Detach(); if (this.cellReferenceLayout != null) { this.cellReferenceLayout.DetachCellElements(); } } protected override void DisposeManagedResources() { if (this.cellReferenceLayout != null) { this.cellReferenceLayout.Dispose(); } base.DisposeManagedResources(); } public override SelfReferenceCellLayout SelfReferenceLayout { get { if (this.RowInfo is GridViewHierarchyRowInfo) { if (this.ViewTemplate != null && this.ViewTemplate.IsSelfReference && this.cellReferenceLayout == null) { this.cellReferenceLayout = new MyLayout(this); } return this.cellReferenceLayout; } return null; } } protected override Type ThemeEffectiveType { get { return typeof(GridDataRowElement); } } }
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(); }
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.
To reproduce: Use the code snippet below: static DataSet ds; public form1() { InitializeComponent(); GridviewStyling(radGridView1); ds = PrepareDataset(); BuildGrid(); //Set_Hierarchy(); for (int i = 0; i < radGridView1.Templates.Count; i++) GridviewTemplateStyling(radGridView1.Templates[i]); this.radGridView1.TableElement.PageViewMode = PageViewMode.ExplorerBar; this.radGridView1.ViewCellFormatting += radGridView1_ViewCellFormatting; } void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e) { GridDetailViewCellElement detailCell = e.CellElement as GridDetailViewCellElement; if (detailCell != null) { GridViewHierarchyRowInfo hierarchyRow = (GridViewHierarchyRowInfo)((GridViewDetailsRowInfo)detailCell.RowInfo).Owner; detailCell.PageViewElement.Header.Visibility = Telerik.WinControls.ElementVisibility.Collapsed; RadPageViewElement el = detailCell.PageViewElement as RadPageViewExplorerBarElement; if (el != null) { for (int i = 0; i < el.Items.Count; i++) // detailCell.PageViewElement.Items.Count { RadPageViewItem item = detailCell.PageViewElement.Items[i]; GridViewInfo viewInfo = hierarchyRow.Views[i]; item.MaxSize = new Size(0, 1); item.Visibility = Telerik.WinControls.ElementVisibility.Hidden; if (viewInfo.ChildRows.Count != 0) { item.Visibility = Telerik.WinControls.ElementVisibility.Collapsed; } } } } } private DataSet PrepareDataset() { Random r = new Random(); DataSet ds = new DataSet("DS"); //snir DataTable dtFirst = new DataTable("Snir"); dtFirst.Columns.Add("pId", typeof(int)); dtFirst.Columns.Add("Col1", typeof(int)); dtFirst.Columns.Add("Col", typeof(string)); dtFirst.Columns.Add("Col3", typeof(int)); dtFirst.Columns.Add("Col4", typeof(string)); for (int i = 0; i < 5; i++) dtFirst.Rows.Add(1, i, "snirsnirsnir" + r.Next(0, 100).ToString(), r.Next(0, 35), "snir" + r.Next(0, 100).ToString()); // jenny DataTable dtSecond = new DataTable("Jenny"); dtSecond.Columns.Add("pId", typeof(int)); dtSecond.Columns.Add("Col1", typeof(int)); dtSecond.Columns.Add("Col2", typeof(string)); dtSecond.Columns.Add("Col3", typeof(int)); dtSecond.Columns.Add("Col4", typeof(string)); dtSecond.Columns.Add("Col5", typeof(string)); dtSecond.Columns.Add("Col6", typeof(string)); for (int i = 0; i < 5; i++) dtSecond.Rows.Add(2, i, "CnC" + r.Next(0, 100).ToString(), r.Next(0, 35), "jenny" + r.Next(0, 100).ToString(), "col5", "col6"); //index DataTable table1 = new DataTable("Index"); table1.Columns.Add("TableId", typeof(int)); table1.Columns.Add("TableName", typeof(string)); table1.Columns.Add("UpdateType", typeof(int)); table1.Rows.Add(1, dtFirst.TableName, r.Next(0, 3)); table1.Rows.Add(2, dtSecond.TableName, r.Next(0, 3)); ds.Tables.AddRange(new DataTable[] { table1, dtFirst, dtSecond }); return ds; } private void BuildGrid() { // bind the master template this.radGridView1.DataSource = ds; this.radGridView1.DataMember = "Index"; //templates GridViewTemplate template1 = new GridViewTemplate(); template1.DataSource = ds.Tables[1]; template1.Columns[0].IsVisible = false; template1.EnableHierarchyFiltering = false; template1.ShowGroupedColumns = false; radGridView1.Templates.Add(template1); GridViewTemplate template2 = new GridViewTemplate(); template2.DataSource = ds.Tables[2]; // 1:snir // 2:jenny radGridView1.Templates.Add(template2); template1.AllowDragToGroup = false; //relations GridViewRelation relation1 = new GridViewRelation(radGridView1.MasterTemplate);//, template2); relation1.RelationName = "myRelation1"; relation1.ChildTemplate = radGridView1.Templates[0]; relation1.ChildColumnNames.AddRange(new string[] { "pId" }); relation1.ParentColumnNames.Add("TableId"); radGridView1.Relations.Add(relation1); GridViewRelation relation2 = new GridViewRelation(radGridView1.MasterTemplate);//, template2); relation2.RelationName = "myRelation2"; relation2.ChildTemplate = radGridView1.Templates[1]; relation2.ChildColumnNames.AddRange(new string[] { "pId" }); relation2.ParentColumnNames.Add("TableId"); radGridView1.Relations.Add(relation2); } private void GridviewStyling(RadGridView rgv) { //radGridView1 styling rgv.AllowAddNewRow = false; rgv.EnableGrouping = false; rgv.AllowDragToGroup = false; rgv.AllowDrop = false; rgv.AllowEditRow = false; rgv.AllowDrop = false; rgv.AllowRowResize = false; rgv.AllowColumnResize = false; rgv.AutoExpandGroups = true; rgv.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; rgv.EnableCustomGrouping = false; rgv.ShowColumnHeaders = true; rgv.ShowRowHeaderColumn = false; rgv.ShowGroupPanel = false; } private void GridviewTemplateStyling(GridViewTemplate gvt) { //template styling gvt.AllowAddNewRow = false; gvt.Columns[0].IsVisible = false; gvt.ShowChildViewCaptions = false; gvt.AllowDragToGroup = false; gvt.AllowRowResize = false; gvt.AllowColumnResize = false; gvt.AutoExpandGroups = true; gvt.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; gvt.ShowRowHeaderColumn = false; gvt.ShowColumnHeaders = true; } private string GetEnumString(int n) { switch (n) { case (int)TableUpdateModeEnum.INSERT: return "INSERT"; case (int)TableUpdateModeEnum.UPDATE: return "UPDATE"; case (int)TableUpdateModeEnum.UPDATE_OR_INSERT: return "UPDATE/DELETE"; case (int)TableUpdateModeEnum.DELETE_OR_INSERT: return "INSERT/DELETE"; default: return ""; } } public enum TableUpdateModeEnum { [Description("Snir")] INSERT = 0, [Description("Liraz")] UPDATE_OR_INSERT = 1, [Description("Jenny")] UPDATE = 2, [Description("Tsuria")] DELETE_OR_INSERT = 3 }; Scenario: 1.Expand a master row. 2.Start dragging columns from the child template. 3.When your are dragging over the thick border , the exception occur.
Add similar like DateColumn.DateTimeMode property for GridViewDateTimeColumn. Link in MSDN: http://msdn.microsoft.com/en-us/library/system.data.datacolumn.datetimemode.aspx
The issue may be releated to measure layout logic. Ticked ID: 381352 One thing more I noticed. Actually I do not think, this issue is a sorting issue, but rather some rendering issue, where the old version is much faster than the new one. If you compare the scrolling performance between the new and the old version, also here the old version is significantly faster. So I think this is a more general issue, something with the rendering - or what you call it - of the visible part of the grid, which are faster in the old version. Am I the only customer noticing this ?
Resolution: Individual cells cannot have specific FormatString since the property is bound to column's FormatString
To reproduce: Sub New() InitializeComponent() Dim dt As New DataTable() For index = 1 To 13 If index = 4 Then dt.Columns.Add("Col" & index, Type.GetType("System.Int32")) Else dt.Columns.Add("Col" & index) End If Next Dim rand As New Random For index = 1 To 9000 Dim newRow As DataRow = dt.NewRow() For Each col As DataColumn In dt.Columns If col.ColumnName = "Col4" Then newRow(col.ColumnName) = rand.Next(2, 1000).ToString() Else newRow(col.ColumnName) = "Data" & index.ToString() & "." & dt.Columns.IndexOf(col).ToString() End If Next dt.Rows.Add(newRow) Next Me.RadGridView1.DataSource = dt Me.RadGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill Me.RadGridView1.Columns.RemoveAt(3) Dim list As New List(Of CustomerMaster) For index = 1 To 1000 list.Add(New CustomerMaster((index + 1), "Name" & (1000 - index + 1).ToString())) Next Dim CustomerMaster_IDColumn As GridViewComboBoxColumn = New GridViewComboBoxColumn With CustomerMaster_IDColumn .Name = "CustomerMaster_ID" .HeaderText = "Customer Master" .DataSource = list .ValueMember = "Id" .DisplayMember = "Name" .FieldName = "Col4" .Width = 200 .DisplayMemberSort = True .DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList End With Me.RadGridView1.Columns.Insert(3, CustomerMaster_IDColumn) End Sub Public Class CustomerMaster Private _id As String Private _name As String Public Sub New(id As String, name As String) Me._id = id Me._name = name End Sub Public Property Id() As String Get Return _id End Get Set(ByVal value As String) _id = value End Set End Property Public Property Name() As String Get Return _name End Get Set(ByVal value As String) _name = value End Set End Property End Class
Steps to reproduce: 1. Add a grid with several columns, so there is horizontal scroll bar 2. Add an image to the grid ImageList 3. In the CellFormatting assign the ImageKey of a cell to a value You will notice that the images are not applied initially. You have to scroll the column where you apply the images out of view and bring it back in to see the images. WORKAROUND Instead of setting the ImageKey property, set the Image property to the corresponding image from the image list.
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; } }
To reproduce: - Add a grid with some columns to a blank form (the rows should not fill the entire space). - Press and hold the left mouse button, the move the mouse to the empty area of the grid. - Continue to move the mouse and you will notice the event is fired several times. Workaround: - use the CurrentCellChanged event.
To reproduce: - Open the examples solution in Visual Studio. - Navigate to hierarchy example. - Enable the excel like filtering for all templates. - Start the application and open the hierarchy first look example. - Add a new row in the second template. - Add such filter that only the newly added row will remain visible. - Expand the new added row and try to add new row to it.
To reproduce: public Form1() { InitializeComponent(); radGridView1.Columns.Add("Id"); radGridView1.Columns.Add("ParentID"); radGridView1.Columns.Add("Name"); radGridView1.Relations.AddSelfReference(radGridView1.MasterTemplate, "Id", "ParentID"); for (int id = 1; id <= 3; id++) { radGridView1.MasterTemplate.Rows.Add(id, 0, "Node_" + id); for (int iChild = 1; iChild <= 5; iChild++) { int childId = id * 100 + iChild; radGridView1.MasterTemplate.Rows.Add(childId, id, "ChildNode_" + childId); } } foreach (GridViewHierarchyRowInfo row in this.radGridView1.Rows) { row.IsExpanded = true; } }