Add a TextAlignment property of GridViewSummaryItem.
When the UserDeletingRow and UserDeletedRow are fired in multi cell selection mode, the event arguments should contains the rows of the selected cells.
Makes RadGridView to be thread safe by using from BackgroundWorker
To reproduce : Create a self-referencing hierarchy, bind it to a BindingList and delete the row with either the delete button or from the context menu and click the deleted item. Workaround : Find the object that has to be deleted, hide the selected row and remove the found object from the data source. void radGridView1_UserDeletingRow(object sender, GridViewRowCancelEventArgs e) { e.Cancel = true; int id = int.Parse(e.Rows[0].Cells["Id"].Value.ToString()); var human = this.humans.FirstOrDefault(x => x.Id == id); if (human != null) { this.radGridView1.SelectedRows[0].IsVisible = false; this.humans.Remove(human); } }
Description: CustomFiltering event does not fire for a RadGridView with Self-Referencing Hierarchy To reproduce: - add RadGridView to a form - EnableCustomFiltering=true and EnableFiltering=true - AddSelfReference Workaround: - First AddSelfReference and bind the grid - Second EnableCustomFiltering=true and EnableFiltering=true
To reproduce: -add RadGridView and RadButton to the form; -apply Office2010Black to the grid; -use the following code: private DataTable dataTable; public Form1() { InitializeComponent(); radGridView1.AutoSizeRows = false; radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; radGridView1.RowFormatting += radGridView1_RowFormatting; radGridView1.ReadOnly = true; radGridView1.ShowRowHeaderColumn = false; radGridView1.VerticalScrollState = ScrollState.AlwaysShow; radGridView1.ThemeName = "Office2010Black"; dataTable = new DataTable(); dataTable.Columns.Add("number", typeof(int)); dataTable.Columns.Add("descriptions", typeof(string)); radGridView1.DataSource = dataTable; } void radGridView1_RowFormatting(object sender, RowFormattingEventArgs e) { e.RowElement.RowInfo.Height = 120; } private void radButton1_Click(object sender, EventArgs e) { radGridView1.Enabled = false; Random rnd = new Random((int)DateTime.Now.Ticks); dataTable.Clear(); for (int i = 0; i < rnd.Next(1000); i++) { DataRow row = dataTable.NewRow(); row[0] = i + 1; row[1] = "description" + i.ToString(); dataTable.Rows.Add(row); } radGridView1.Enabled = true; } After clicking the button, notice that the vertical scroll bar is not painted correctly and it is resized when scrolling. Workaround: Update the button Click event as follows: private void radButton1_Click(object sender, EventArgs e) { radGridView1.VerticalScrollState = ScrollState.AlwaysHide; radGridView1.Enabled = false; radGridView1.BeginEdit(); Random rnd = new Random((int)DateTime.Now.Ticks); dataTable.Clear(); for (int i = 0; i < rnd.Next(1000); i++) { DataRow row = dataTable.NewRow(); row[0] = i + 1; row[1] = "description" + i.ToString(); dataTable.Rows.Add(row); } radGridView1.EndEdit(); radGridView1.Enabled = true; radGridView1.VerticalScrollState = ScrollState.AlwaysShow; radGridView1.TableElement.VScrollBar.ResetLayout(true); radGridView1.MasterTemplate.Refresh(); radGridView1.TableElement.ScrollToRow(radGridView1.CurrentRow); }
To reproduce: - add RadGridView and populate it manually with hierarchical data; - open one row child rows and select several child rows; - right click to open the context menu and select Copy; - paste in Notepad for example. As a result there is no pasted data. Workaround: radGridView1.ContextMenuOpening += radGridView1_ContextMenuOpening; string clipBoard = string.Empty; RadGridView contextMenuInvoker; void radGridView1_ContextMenuOpening(object sender, Telerik.WinControls.UI.ContextMenuOpeningEventArgs e) { RadGridView grid = sender as RadGridView; if (grid.CurrentCell is GridDataCellElement || grid.CurrentCell is GridTableBodyElement) { if (grid.CurrentRow.ViewTemplate != grid.MasterGridViewTemplate && !(grid.CurrentCell.RowInfo is GridViewNewRowInfo)) { RadMenuItem itemCopy = new RadMenuItem(); itemCopy.Text = "Copy Row(s)"; itemCopy.Click += new EventHandler(itemCopy_Click); e.ContextMenu.Items.RemoveAt(3); e.ContextMenu.Items.Insert(3, itemCopy); e.ContextMenu.Items.RemoveAt(4); } contextMenuInvoker = grid; } } void itemCopy_Click(object sender, EventArgs e) { CopyRows(contextMenuInvoker); } private void CopyRows(RadGridView radGridView) { StringBuilder sb = new StringBuilder(); foreach (GridViewRowInfo row in radGridView.SelectedRows) { int i = 0; while (i < row.Cells.Count) { if (i > 0) { sb.Append(","); } sb.Append(row.Cells[i].Value.ToString()); i++; } sb.AppendLine(";"); } clipBoard = sb.ToString(); Clipboard.SetDataObject(clipBoard); }
To reproduce: - add RadGridView and fill it with data; - use the following code for saving the layout: string layout; using (MemoryStream ms = new MemoryStream()) { radGridView1.SaveLayout(ms); ms.Position = 0; byte[] buffer = new byte[ms.Length - 1]; ms.Read(buffer, 0, buffer.Length); layout = Convert.ToBase64String(buffer); ms.Close(); } When you try to load the saved layout, using the following code, DataException is thrown: using (MemoryStream stream = new MemoryStream(Convert.FromBase64String(layout))) { radGridView1.LoadLayout(stream); } Workaround: save the layout in xml file
Workaround: set the Position of the current item of the BindingSource in the CurrentRowChanged event of RadGridView: void rgvInvoices_CurrentRowChanged(object sender, CurrentRowChangedEventArgs e) { int index = bsInvoices.IndexOf(e.CurrentRow.DataBoundItem) ; bsInvoices.Position = index; }
FIX. RadGridView - when AlternatingRowColors is enabled and the grid is sorted the colorized rows are wrong.
To reproduce: 1.Set the column AutoCompleteMode to suggest 2. Type a letter which does not exist in the records (if you have A, B, and C, use D) 3. Press escape 4. Type in another letter which does not exist => the exception is thrown The GridRowBehavior is trying to access the AutoCompleteAppend of the element, which is null, while we are in Suggest mode.
When RadRadioButton column is bound to a column containing integer values and RadGridView is being reenabled all radio buttons are with ToggleState.On.
To reproduce: bind the grid to self reference data source, and on a button click, Fill the TableAdapter Workaround: clear the relations to clear the cache and add them back after the adapter is filled: RadGridView1.Relations.Clear() Me.Table1TableAdapter.Fill(Me.Database8DataSet.Table1) Me.RadGridView1.Relations.AddSelfReference(Me.RadGridView1.MasterTemplate, "TaskID", "ParentTask")
To reproduce: Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load BindGrid() End Sub Private Sub BindGrid() Dim r As New Random() Dim table As New DataTable() table.Columns.Add("ID", GetType(Integer)) table.Columns.Add("Name", GetType(String)) table.Columns.Add("Bool", GetType(Boolean)) For i As Integer = 0 To 39 table.Rows.Add(i, "Row " & i, If(r.[Next](10) > 5, True, False)) Next Me.RadGridView1.DataSource = table End Sub Dim saveName As Integer Private Sub RadGridView1_CellEndEdit(sender As Object, e As Telerik.WinControls.UI.GridViewCellEventArgs) Handles RadGridView1.CellEndEdit If e.Column.Name = "Name" Then saveName = RadGridView1.CurrentRow.Cells("ID").Value BindGrid() End If End Sub Private Sub RadGridView1_DataBindingComplete(sender As Object, e As Telerik.WinControls.UI.GridViewBindingCompleteEventArgs) Handles RadGridView1.DataBindingComplete For Each row As GridViewRowInfo In RadGridView1.Rows If row.Cells("ID").Value = saveName Then row.IsCurrent = True RadGridView1.TableElement.EnsureRowVisible(row) Exit For End If Next End Sub WORKAROUND: Rebind the grid in the CellValueChanged event instead of the CellEndEdit event: Private Sub RadGridView1_CellValueChanged(sender As Object, e As Telerik.WinControls.UI.GridViewCellEventArgs) Handles RadGridView1.CellValueChanged If e.Column.Name = "Name" Then saveName = RadGridView1.CurrentRow.Cells("ID").Value BindGrid() End If End Sub
To reproduce: - Set BeginEditMod to BeginEditProgrammatically - Check/uncheck a check box cell and you will be able to edit the rest of the cells
To reproduce: - Add a checkbox column to a grid - Add the following code to the ValueChanged event: void radGridView1_ValueChanged(object sender, EventArgs e) { if (radGridView1.CurrentColumn.Name == "BoolColumn") {
To reproduce: Dim dockmem As New MemoryStream Dim gridmem As New MemoryStream Public Sub SetData() ' dgvSelectList.DataSource = Nothing Dim dt As DataTable dt = New DataTable dt.Columns.Add("VENDCODE") dt.Columns.Add("VENDNAME") dt.Rows.Add("AA2", "Arthur") dt.Rows.Add("AA2", "Arthur") dgvSelectList.DataSource = dt dgvSelectList.BestFitColumns() End Sub Private Sub frmSelectListNG2_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load SetData() dgvSelectList.EnableFiltering = False 'Save Grid and Dock layout settings to mem stream and simulate my process SaveSettings() End Sub Public Sub btnGO_Click(sender As System.Object, e As System.EventArgs) Handles btnGO.Click LoadSettings() dgvSelectList.SplitMode = RadGridViewSplitMode.Horizontal SetData() LoadSettings() End Sub Private Sub LoadSettings() gridmem.Position = 0 dockmem.Position = 0 dgvSelectList.LoadLayout(gridmem) rdkSelect.LoadFromXml(dockmem) End Sub Private Sub SaveSettings() gridmem.Position = 0 dockmem.Position = 0 dgvSelectList.SaveLayout(gridmem) rdkSelect.SaveToXml(dockmem) End Sub Workaround - set the datasource to Nothing prior rebinding
Workaround, use the following behavior: public class CustomDataRowBehavior : GridDataRowBehavior { protected override bool OnMouseDownRight(MouseEventArgs e) { if (this.IsInEditMode && !this.GridViewElement.EndEdit())
To reproduce: - add a grid to the form and use the following code for its setup: radGridView2.Columns.Add("ID"); radGridView2.Columns.Add("Title"); radGridView2.MultiSelect = true; radGridView2.Columns[0].SortOrder = RadSortOrder.Ascending; radGridView2.ReadOnly = true; radGridView2.BeginUpdate(); for (int i = 0; i < 5; i++) { GridViewDataRowInfo row = new GridViewDataRowInfo(radGridView2.MasterTemplate.MasterViewInfo); row.Cells["ID"].Value = i; row.Cells["Title"].Value = "Title " + i; radGridView2.Rows.Add(row); } radGridView2.EndUpdate(true); radGridView2.Rows[0].IsCurrent = true; radGridView2.Rows[0].IsSelected= true; - Once the application is started, hold down the shift key and click the third row in the grid Expected result: the first three rows are selected Actual result: the last three rows are selected WORKAROUND: Use the BeginUpdate and EndUpdate methods of the TableElement, not the control: radGridView2.TableElement.BeginUpdate(); //add rows radGridView2.TableElement.EndUpdate(true);
To reproduce: - Add a grid to a form and open the property builder - Add couple columns and group by some of the columns - Press ok -> the grid is grouped - Open the Property Builder again, click the X button of the group to remove it and click the OK button of the Property Builder -> the group is not removed.