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);
}
}
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
To reproduce: use the following code snippet and try to filter the second column:
public Form1()
{
InitializeComponent();
this.radGridView1.Columns.Add("Id");
GridViewDateTimeColumn dateTimeColumn = new GridViewDateTimeColumn();
dateTimeColumn.FilteringMode = GridViewTimeFilteringMode.Date;
dateTimeColumn.Name = "NullDateTimeColumn";
dateTimeColumn.HeaderText = "Order date";
dateTimeColumn.FieldName = "OrderDate";
dateTimeColumn.FormatString = "{0:dd/MM/yyyy}";
this.radGridView1.Columns.Add(dateTimeColumn);
dateTimeColumn = new GridViewDateTimeColumn();
dateTimeColumn.FilteringMode = GridViewTimeFilteringMode.Date;
dateTimeColumn.Name = "DateTimeColumn";
dateTimeColumn.HeaderText = "Not Null Date date";
dateTimeColumn.FieldName = "NotNullDate";
dateTimeColumn.FormatString = "{0:dd/MM/yyyy}";
this.radGridView1.Columns.Add(dateTimeColumn);
this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
for (int i = 0; i < 50; i++)
{
if (i % 2 == 0)
{
this.radGridView1.Rows.Add(new object[] { i, null, DateTime.Today });
}
else
{
this.radGridView1.Rows.Add(new object[] { i, DateTime.Now.AddDays(i), DateTime.Today });
}
}
this.radGridView1.EnableFiltering = true;
this.radGridView1.MasterTemplate.ShowHeaderCellButtons = true;
this.radGridView1.MasterTemplate.ShowFilteringRow = false;
}
private void radGridView1_FilterPopupRequired(object sender, FilterPopupRequiredEventArgs e)
{
e.FilterPopup = new RadListFilterPopup(e.Column, true);
}
Workaround: use a specific DateTime value instead of null (e.g. 1/1/1800) and use the CellFormatting event to clear the displayed text. Afterwards, in the RadListFilterPopup it is necessary to hide the text for the null value date nodes:
public Form1()
{
InitializeComponent();
this.radGridView1.Columns.Add("Id");
GridViewDateTimeColumn dateTimeColumn = new GridViewDateTimeColumn();
dateTimeColumn.FilteringMode = GridViewTimeFilteringMode.Date;
dateTimeColumn.Name = "NullDateTimeColumn";
dateTimeColumn.HeaderText = "Order date";
dateTimeColumn.FieldName = "OrderDate";
dateTimeColumn.FormatString = "{0:dd/MM/yyyy}";
this.radGridView1.Columns.Add(dateTimeColumn);
dateTimeColumn = new GridViewDateTimeColumn();
dateTimeColumn.FilteringMode = GridViewTimeFilteringMode.Date;
dateTimeColumn.Name = "DateTimeColumn";
dateTimeColumn.HeaderText = "Not Null Date date";
dateTimeColumn.FieldName = "NotNullDate";
dateTimeColumn.FormatString = "{0:dd/MM/yyyy}";
this.radGridView1.Columns.Add(dateTimeColumn);
this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
for (int i = 0; i < 50; i++)
{
if (i % 2 == 0)
{
this.radGridView1.Rows.Add(new object[] { i, new DateTime(1800, 1, 1), DateTime.Today });
}
else
{
this.radGridView1.Rows.Add(new object[] { i, DateTime.Now.AddDays(i), DateTime.Today });
}
}
this.radGridView1.EnableFiltering = true;
this.radGridView1.MasterTemplate.ShowHeaderCellButtons = true;
this.radGridView1.MasterTemplate.ShowFilteringRow = false;
}
private void radGridView1_FilterPopupRequired(object sender, FilterPopupRequiredEventArgs e)
{
RadListFilterPopup popup = new RadListFilterPopup(e.Column, true);
e.FilterPopup = popup;
popup.PopupOpened += popup_PopupOpened;
}
private void popup_PopupOpened(object sender, EventArgs args)
{
RadListFilterPopup popup = sender as RadListFilterPopup;
if (popup != null)
{
popup.MenuTreeElement.TreeView.NodeFormatting += TreeView_NodeFormatting;
popup.MenuTreeElement.TreeView.Focus();
}
}
private void TreeView_NodeFormatting(object sender, TreeNodeFormattingEventArgs e)
{
if (e.NodeElement.ContentElement.Text.Contains("1800"))
{
e.NodeElement.ContentElement.DrawText = false;
e.NodeElement.ExpanderElement.Opacity = 0;
e.NodeElement.ExpanderElement.ShouldHandleMouseInput = false;
e.NodeElement.ShouldHandleMouseInput = false;
}
else
{
e.NodeElement.ContentElement.DrawText = true;
e.NodeElement.ExpanderElement.Opacity = 1;
e.NodeElement.ExpanderElement.ShouldHandleMouseInput = true;
e.NodeElement.ShouldHandleMouseInput = true;
}
}
private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
GridViewDateTimeColumn dtCol = e.Column as GridViewDateTimeColumn;
if (e.Row is GridViewDataRowInfo && dtCol != null && ((DateTime)e.CellElement.Value).Year == 1800)
{
e.CellElement.Text = string.Empty;
}
}
To reproduce:
1. Perform searching in the grid.
2. Sort by a random column.
3. Navigating with next/previous buttons do not navigate the results in the displayed order. Please refer to the attached gif file.
Workaround: clear the cache of the search row after sorting is changed:
private void radGridView1_SortChanged(object sender, Telerik.WinControls.UI.GridViewCollectionChangedEventArgs e)
{
string searchCriteria = this.radGridView1.MasterView.TableSearchRow.SearchCriteria;
FieldInfo fi = typeof(GridViewSearchRowInfo).GetField("cache",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
Hashtable cache = fi.GetValue(this.radGridView1.MasterView.TableSearchRow) as Hashtable;
cache.Clear();
this.radGridView1.MasterView.TableSearchRow.Search(searchCriteria);
}
Workaround - hide the expander items if space is not enough:
private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
GridDataCellElement cell = e.CellElement as GridDataCellElement;
if (cell != null && cell.SelfReferenceLayout != null)
{
foreach (RadElement element in cell.SelfReferenceLayout.StackLayoutElement.Children)
{
GridExpanderItem expanderItem = element as GridExpanderItem;
if (expanderItem != null)
{
if (cell.ColumnInfo.Width < cell.SelfReferenceLayout.StackLayoutElement.Size.Width)
{
expanderItem.Opacity = 0;
}
else
{
expanderItem.Opacity = 1;
}
}
}
}
}
To reproduce:
- Add self-reference hierarchy and set a checkbox column as expander column - show the column at runtime upon button click.
- You will notice that the layout is not updated properly.
- If the column is small the checkboxes appear in the next cell.
Workaround:
Update the layout when the column is made visible:
this.gridViewParameter.TableElement.UpdateView();
Set the ClipDrawing property of the checkbox cells to true:
void gridViewParameter_CellFormatting(object sender, CellFormattingEventArgs e)
{
if (e.CellElement is GridCheckBoxCellElement)
{
e.CellElement.ClipDrawing = true;
}
else
{
e.CellElement.ResetValue(LightVisualElement.ClipDrawingProperty, Telerik.WinControls.ValueResetFlags.Local);
}
}
How to reproduce: Create a grid in self referencing hierarchy and set up a filter expression like this: this.radGridView1.FilterDescriptors.Expression = "Name = \"bin\" AND (FileSystemInfoType = \"Folder\" OR Id = \"2\")" Immediately after the expression is set, the OR logical operator is substituted with AND
workaround: in the handler of the Load event explicitly set the scroll bar value to 0 this.radGridView1.TableElement.VScrollBar.Value = 0;
How to reproduce:
public Form1()
{
InitializeComponent();
string newLine = "line";
string multiLine = "line";
for (int i = 0; i < 10; i++)
{
radGridView1.Rows.Add(newLine, multiLine);
multiLine += Environment.NewLine + multiLine;
}
this.Load += Form1_Load;
}
Workaround:
private void Form1_Load(object sender, EventArgs e)
{
this.radGridView1.Columns[1].PropertyChanged += item_PropertyChanged;
}
private void item_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "IsVisible")
{
this.radGridView1.TableElement.ScrollTo(0, 0);
}
}
To reproduce:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.CustomersTableAdapter.Fill(Me.NwindDataSet.Customers)
Me.RadGridView1.DataSource = Me.CustomersBindingSource
Dim view As 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(Me.RadGridView1.Columns("CompanyName"))
view.ColumnGroups(0).Rows(0).Columns.Add(Me.RadGridView1.Columns("ContactName"))
view.ColumnGroups(0).Rows(0).Columns.Add(Me.RadGridView1.Columns("ContactTitle"))
view.ColumnGroups(1).Groups(0).Rows.Add(New GridViewColumnGroupRow())
view.ColumnGroups(1).Groups(0).Rows(0).Columns.Add(Me.RadGridView1.Columns("Address"))
view.ColumnGroups(1).Groups(0).Rows(0).Columns.Add(Me.RadGridView1.Columns("City"))
view.ColumnGroups(1).Groups(0).Rows(0).Columns.Add(Me.RadGridView1.Columns("Country"))
view.ColumnGroups(1).Groups(1).Rows.Add(New GridViewColumnGroupRow())
view.ColumnGroups(1).Groups(1).Rows(0).Columns.Add(Me.RadGridView1.Columns("Phone"))
view.ColumnGroups(1).Groups(1).Rows(0).Columns.Add(Me.RadGridView1.Columns("Fax"))
RadGridView1.ViewDefinition = view
RadGridView1.BestFitColumns(BestFitColumnMode.AllCells)
End Sub
Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
Dim spreadExporter As New GridViewSpreadExport(RadGridView1)
Dim fileName As String = "..\..\exported.xlsx"
Dim exportRenderer As New SpreadExportRenderer()
spreadExporter.SheetName = "Sheet1"
spreadExporter.ExportVisualSettings = True
spreadExporter.SummariesExportOption = SummariesOption.ExportOnlyTop
spreadExporter.SheetMaxRows = ExcelMaxRows._1048576
spreadExporter.HiddenColumnOption = HiddenOption.DoNotExport
spreadExporter.HiddenRowOption = HiddenOption.DoNotExport
spreadExporter.FileExportMode = FileExportMode.CreateOrOverrideFile
spreadExporter.RunExport(fileName, exportRenderer)
Process.Start(fileName)
End Sub
Workaround: by using the SpreadExportRenderer.WorkbookCreated event you can remove the header cells and add new ones in order to display the same header layout as in the grid:
http://www.telerik.com/help/winforms/gridview-exporting-data-spread-export.html
http://www.telerik.com/help/winforms/spreadprocessing-working-with-cells-insert-remove-cells.html
http://www.telerik.com/blogs/getting-started-with-radspreadprocessing-volume-1
“Missing data after apply Object-Relational filtering operation” as in the attached, also capture case simulation in video file to illustrate how the case happen to support your investigation. Scenario case: · Expand Parent Data 2 à will see child data level (child data 2.1.1, child data 2.1.2, child data 2.1.3) · Filter child data that contains value = input “2.1.4” (mismatch case filter)· Current Result : Not show all 3 child data and cannot get it back to display again In this case, normally how the component handle this “not found filtering result” case, is it normal to display result like this? If so please help recommend how we can get 3 child data back for doing any further process.
To reproduce: 1. Add a grid to a form. 2. Set its SplitMode to vertical or horizontal. 3. Set its SynchronizeCurrentRowInSplitMode to false. You will notice that both grids are synchronized. Workaround: Add two RadgridViews in a RadSplitContainer with two split panels and use two separate data sources. For example: List<string> ds = new List<string>(); grid1.DataSource = ds; grid2.DataSource = ds.ToArray();
To reproduce: - Add two child templates to a grid. - Add summary rows to both of them - Change the value of the child template. Workaround: - Clear and add back the summary rows when a value in the child template is changed.
Workaround, use the Pasting event of RadGridView and perform the needed validation
To reproduce:
radGridView1.DataSource = GetTable();
radGridView1.MultiSelect = true;
radGridView1.SelectionMode = Telerik.WinControls.UI.GridViewSelectionMode.CellSelect;
Then just select and deselect several cells without releasing the mouse button.
Workaround:
void radGridView1_MouseUp(object sender, MouseEventArgs e)
{
int endIndexCol = -1;
int endIndexRow = -1;
GridDataCellElement curentCell = radGridView1.ElementTree.GetElementAtPoint(e.Location) as GridDataCellElement;
if (curentCell != null)
{
endIndexCol = curentCell.ColumnInfo.Index;
endIndexRow = curentCell.RowInfo.Index;
}
if (endIndexCol < startIndexCol)
{
int temp = endIndexCol;
endIndexCol = startIndexCol;
startIndexCol = temp;
}
if (endIndexRow < startIndexRow)
{
int temp = endIndexRow;
endIndexRow = startIndexRow;
startIndexRow = temp;
}
foreach (GridViewCellInfo cell in radGridView1.SelectedCells.ToList())
{
if (cell.RowInfo.Index < startIndexRow || cell.RowInfo.Index > endIndexRow)
{
cell.IsSelected = false;
}
if (cell.ColumnInfo.Index < startIndexCol || cell.ColumnInfo.Index > endIndexCol)
{
cell.IsSelected = false;
}
}
}
int startIndexCol = -1 ;
int startIndexRow = -1;
void radGridView1_MouseDown(object sender, MouseEventArgs e)
{
GridDataCellElement curentCell = radGridView1.ElementTree.GetElementAtPoint(e.Location) as GridDataCellElement;
if (curentCell != null)
{
startIndexCol = curentCell.ColumnInfo.Index;
startIndexRow = curentCell.RowInfo.Index;
}
}
The issue is reproduced when the columns for GridViewTemplate are added last in the end after the all hierarchy settings: relations, templates
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;
}