Hi,
Please check the attached sample project.
I think CompositeFilter does not respect CaseSensitive property.
Thanks
When RadGridView is bound to a collection of 60 000 records the difference in the sorting time between using a ProBindingSource and a DataTable is massive. Changes in any core logic in both internal implementations, RadGridView and ProBindingSource, isn't so easy as it looks. Both products have been for a very long time on the market designed to cover the main scenarios of the target customers groups for which they are developed.
By default, if the rows count is less than 10 000 we use quick sort to order the items in the grid. If there are more items we use Red-Black tree. This is controlled by the UseHybridIndex property.
(radGridView.MasterTemplate.ListSource.CollectionView as GridDataView).UseHybridIndex = false;
However, both of algorithms use non-linear data access. If the ProBindingSource is not optimized to get data not linearly, the performance wouldn't be satisfactory.
That is why we have introduced the BypassSort functionality to cover this case after cooperation with the OE developers. Thus, our RadGridView won't perform any logic for sorting and the whole time necessary for sorting will depend on the DataSource itself (ProBindingSource in your case) and how this collection sorts its items: https://docs.telerik.com/devtools/winforms/controls/gridview/sorting/basic-sorting
In the current version of Telerik UI for WinForms suite, the BypassSort property is ignored if the BypassFilter is not set to true as well. Hence, the sorting will be still slow.
Both properties shouldn't affect each other and if a developer wants to improve only the sorting performance, it is expected to enable only the ByPassSort property.
Hello.
In my application, depending on the specific data in the grid I may want to warn a user who clicks on the header checkbox that changing all the values in that column may not be what he intends, allowing him to cancel out of the operation. I haven't found a handler that gets called when clicking on the header checkbox that allows me to cancel the event. How can I accomplish this?
Please follow the instruction in this help article: https://docs.telerik.com/devtools/winforms/controls/spellchecker/spellchecking-radgridview
Then, follow the steps illustrated in the attached gif file.
Please refer to the attached sample project and follow the steps illustrated in the gif file.
The issue is also reproducible in the Demo application.
Workaround: in the RadDataFilter.Edited event you can use the Expression to filter the grid:
Me.RadGridView1.FilterDescriptors.Expression = Me.RadDataFilter1.Expression
Steps to reproduce:
1. Bind RadGridView to BindingList
2. Clear the rows collection
3. You can see that SelectedRows.Count =1 although Rows.Count = 0
To workaround:
private void radButton1_Click(object sender, EventArgs e)
{
while (this.pedidos.Count > 0)
{
this.pedidos.RemoveAt(0);
}
int rows = this.radGridView1.Rows.Count;
int srows = this.radGridView1.SelectedRows.Count;
}
Hello,
I am using a radGridView on a Windows touch screen. When I am trying to scroll the rows by hand (EnableKineticScrolling was set to true), the scrolling process is very slow. If I will use the vertical scrollbar, then it is ok. How can I achieve this without using the vertical scrollbar?
I used EnableFastScrolling=true, but I did not see any improvement.
Regards,
Yannis
Please refer to the attached sample project and the follow the steps in the gif file.
Workaround: scroll to the top and then to the bottom again to update the scrollbar's range
Hi,
I have to transfer data from gridview to a .xlsm file which is for the salary transfer to the bank from the application (Template given by the Bank).
File screenshot attached.
Need to fill the cells from the loaded gridview to this template.
Please help; I have searched a lot but no luck.
Thank you very much.
Hi,
I am working with the RadGridView in my c# winform application. I am using the custom font ("Font Awesome 5 Free Solid") for the RadGridView using the "CellFormatting" event to view the icons along with the text. Here i am able to see the proper icons with text but when i open the filter menu to filter out the rows, i am unable to see the icons (icons shown as the box) as in filterbox we don't have any custom font.
I tried to working out the properties of the RadTreeNodeCollection but here we dont have any Custom font property for the same.
i want to show the text as it is in the filterbox along with the text and the icon.
so can you suggest what i can do to view the icons in the filterbox?
Check the attachment for reference.
Hi,
when I select the column chooser multiple times via context menu, the column chooser dialog scales multiple times.
Reproduced here with the Telerik sample application. 150 % dpi scaling.
Regards
Erwin
I'm just starting with RadGridView and trying to figure out how to create a combobox column inside my RadGridView. I've added a column that is of type GridViewComboBoxColumn. I've created a BindingSource that Contains the values for the combobox. I can't figure out how to set the datasource property of the Column to use that BindingSource. Google search says to set the datasource property but when I'm going through the "Open Properties Builder" and I select my combobox column I don't see that property listed under advanced for the column.
Thanks
Lee
If you want to use Conditional Formatting via code (expression based formatting) you will see that it throws an exception if you set TRIM() condition.
ExpressionFormattingObject expressionCondition = new ExpressionFormattingObject(
expressionCondition.Expression = "TRIM(ContactName) = 'Maria Anders'";
expressionCondition.CellBackColor = Color.Aqua;
this.radGridView1.Columns["CustomerID"].ConditionalFormattingObjectList.Add(expressionCondition);
There is no exception if you use the same condition via "Conditional Formatting Rules Manager" form.
Please refer to the attached gif file. You will notice that for the GridViewMaskBoxColumn with numeric mask the filtering doesn't work. For the other columns each key stroke filters the grid rows.
Workaround: either use a GridViewDecimalColumn or change the default editor for the GridViewMaskBoxColumn :
Using a custom control using the Telerik Presentation Framework, I am receiving a NullException inside the GridCheckBoxHeaderCellElement during the GridViewElement's data load.
The custom control construction follows an example I found somewhere (reference is lost to me at this point):
ControlContainingGridView inherits from RadControl
CreateChildItems creates and adds ControlContainingGridViewElement
ControlContainingGridViewElement inherits from RadElement
CreateChildItems creates and adds some layout controls AND a GridViewElement
public partial class ControlContainingGridView : RadControl {
public ControlContainingGridView() {
InitializeComponent();
this.TextChanged += ControlContainingGridView_TextChanged;
}
private void ControlContainingGridView_TextChanged(object sender, EventArgs e) {
controlContainingGridViewElement.Text = this.Text;
}
private ControlContainingGridViewElement controlContainingGridViewElement = null;
protected override void CreateChildItems(RadElement parent) {
controlContainingGridViewElement = new ControlContainingGridViewElement();
this.RootElement.Children.Add(controlContainingGridViewElement);
base.CreateChildItems(parent);
}
public object DataSource {
get {
return controlContainingGridViewElement.GridView.Template.DataSource;
}
set {
try {
controlContainingGridViewElement.GridView.Template.DataSource = value;
} catch (Exception ex) {
Debug.WriteLine(ex);
}
}
}
internal void SetupColumns(Action<MasterGridViewTemplate> setupColumns) {
controlContainingGridViewElement.GridView.Template.AutoGenerateColumns = false;
setupColumns(controlContainingGridViewElement.GridView.Template);
}
}
public class ControlContainingGridViewElement : RadElement {
private TextPrimitive textPrimitive = null;
private RadButtonElement addButton = null;
private RadButtonElement deleteButton = null;
private RadGridViewElement gridViewElement = null;
public RadGridViewElement GridView { get { return gridViewElement; } }
public bool ShowAddButton { get { return addButton.Visibility == ElementVisibility.Visible; } set { addButton.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed; } }
public bool ShowDeleteButton { get { return deleteButton.Visibility == ElementVisibility.Visible; } set { deleteButton.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed; } }
public string Text { get { return textPrimitive.Text; } set { textPrimitive.Text = value; } }
protected override void CreateChildElements() {
DockLayoutPanel dlp = new DockLayoutPanel();
dlp.StretchHorizontally = true;
dlp.StretchHorizontally = true;
dlp.LastChildFill = true;
DockLayoutPanel dlpBar = new DockLayoutPanel();
dlpBar.StretchHorizontally = true;
DockLayoutPanel.SetDock(dlpBar, Dock.Top);
var imagePrimitive = new ImagePrimitive();
DockLayoutPanel.SetDock(imagePrimitive, Dock.Left);
textPrimitive = new TextPrimitive();
DockLayoutPanel.SetDock(textPrimitive, Dock.Left);
var slp = new StackLayoutPanel();
DockLayoutPanel.SetDock(slp, Dock.Right);
var addButton = new RadButtonElement {
Text = "Add",
MaxSize = new Size() { Height = 20 }
};
var deleteButton = new RadButtonElement {
Text = "Del",
MaxSize = new Size() { Height = 20 }
};
slp.Children.Add(addButton);
slp.Children.Add(deleteButton);
dlpBar.Children.Add(slp);
dlpBar.Children.Add(imagePrimitive);
dlpBar.Children.Add(textPrimitive);
gridViewElement = new RadGridViewElement {
StretchHorizontally = true,
StretchVertically = true
};
gridViewElement.Template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
gridViewElement.Template.AllowAddNewRow = false;
gridViewElement.Template.AllowDeleteRow = false;
gridViewElement.Template.AllowDragToGroup = false;
gridViewElement.ShowGroupPanel = false;
gridViewElement.ShowGroupPanelScrollbars = false;
dlp.Children.Add(dlpBar);
dlp.Children.Add(gridViewElement);
this.Children.Add(dlp);
base.CreateChildElements();
}
}
During Form load, I programmatically add columns and provide a binding source
private List<SampleModel> sampleModels = new List<SampleModel>();
private BindingSource sampleModelsBinding = new BindingSource();
private void RadForm1_Load(object sender, EventArgs e) {
sampleModels.Add(new SampleModel() {
When = DateTime.Parse("1980-04-23"),
SomeText = "Purple Bananas",
IsTrue = true
});
sampleModels.Add(new SampleModel() {
When = DateTime.Parse("2002-07-20"),
SomeText = "Ball & Chain",
IsTrue = false
});
sampleModelsBinding.DataSource = sampleModels;
controlContainingGridView.SetupColumns((grid) => {
grid.AddDateTimeColumn(nameof(SampleModel.When), "When");
grid.AddTextBoxColumn(nameof(SampleModel.SomeText), "Some Text");
grid.AddCheckBoxColumn(nameof(SampleModel.IsTrue), "Is True");
});
controlContainingGridView.DataSource = sampleModelsBinding;
}
Inclusion of the CheckBox column results in the following error:
Exception thrown: 'System.NullReferenceException' in Telerik.WinControls.GridView.dll
System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.WinControls.UI.GridCheckBoxHeaderCellElement.Attach(GridViewColumn data, Object context)
at Telerik.WinControls.UI.BaseVirtualizedContainer`1.InsertElement(Int32 position, IVirtualizedElement`1 element, T data)
at Telerik.WinControls.UI.BaseVirtualizedContainer`1.UpdateElement(Int32 position, T data)
at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureElements()
at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureOverride(SizeF availableSize)
at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
at Telerik.WinControls.UI.GridVirtualizedRowElement.MeasureElements(SizeF availableSize, SizeF clientSize, Padding borderThickness)
at Telerik.WinControls.UI.LightVisualElement.MeasureOverride(SizeF availableSize)
at Telerik.WinControls.UI.GridRowElement.MeasureOverride(SizeF availableSize)
at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
at Telerik.WinControls.UI.VirtualizedStackContainer`1.MeasureElementCore(RadElement element, SizeF availableSize)
at Telerik.WinControls.UI.ScrollableRowsContainerElement.MeasureElementCore(RadElement element, SizeF availableSize)
at Telerik.WinControls.UI.VirtualizedStackContainer`1.MeasureElement(IVirtualizedElement`1 element)
at Telerik.WinControls.UI.PinnedRowsContainerElement.MeasureElement(IVirtualizedElement`1 element)
at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureElements()
at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureOverride(SizeF availableSize)
at Telerik.WinControls.UI.ScrollableRowsContainerElement.MeasureOverride(SizeF availableSize)
at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
at Telerik.WinControls.UI.RowsContainerElement.MeasureOverride(SizeF availableSize)
at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
at Telerik.WinControls.UI.ScrollViewElement`1.MeasureViewElement(SizeF availableSize)
at Telerik.WinControls.UI.ScrollViewElement`1.MeasureView(SizeF availableSize)
at Telerik.WinControls.UI.ScrollViewElement`1.MeasureOverride(SizeF availableSize)
at Telerik.WinControls.UI.GridTableElement.MeasureOverride(SizeF availableSize)
at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
at Telerik.WinControls.Layouts.DockLayoutPanel.MeasureOverride(SizeF constraint)
at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
at Telerik.WinControls.Layouts.ContextLayoutManager.UpdateLayout()
at Telerik.WinControls.UI.GridVisibilityHelper.EnsureRowVisible(GridViewRowInfo rowInfo)
at Telerik.WinControls.UI.GridTableElement.EnsureRowVisible(GridViewRowInfo rowInfo)
at Telerik.WinControls.UI.GridTableElement.EnsureCellVisible(GridViewRowInfo rowInfo, GridViewColumn column)
at Telerik.WinControls.UI.GridTableElement.UpdateViewCore(Object sender, DataViewChangedEventArgs args)
at Telerik.WinControls.UI.GridTableElement.UpdateView(Object sender, DataViewChangedEventArgs args)
at Telerik.WinControls.UI.GridTableElement.ProcessTemplateEvent(GridViewEvent eventData)
at Telerik.WinControls.UI.GridTableElement.Telerik.WinControls.UI.IGridViewEventListener.ProcessEvent(GridViewEvent eventData)
at Telerik.WinControls.UI.GridViewEventProcessEntity.ProcessCollection(GridViewEvent gridEvent, PriorityWeakReferenceList list, GridEventProcessMode processMode)
at Telerik.WinControls.UI.GridViewEventProcessEntity.ProcessEvent(GridViewEvent gridEvent)
at Telerik.WinControls.UI.GridViewSynchronizationService.NotifyListeners(GridViewEvent gridEvent)
at Telerik.WinControls.UI.GridViewSynchronizationService.FlushEvents()
at Telerik.WinControls.UI.GridViewSynchronizationService.DispatchEvent(GridViewEvent gridEvent)
at Telerik.WinControls.UI.GridViewSynchronizationService.RaiseCurrentChanged(GridViewTemplate template, GridViewRowInfo row, GridViewColumn column, Boolean user)
at Telerik.WinControls.UI.GridViewTemplate.CollectionView_CurrentChanged(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at Telerik.WinControls.Data.RadCollectionView`1.OnCurrentChanged(EventArgs args)
at Telerik.WinControls.Data.RadCollectionView`1.SetCurrentPositionCore(Int32 newPosition, Boolean forceNotify, CurrentChangeReason reason)
at Telerik.WinControls.Data.RadListSource`1.InitializeCurrentItem()
at Telerik.WinControls.Data.RadListSource`1.Initialize()
at Telerik.WinControls.Data.RadListSource`1.Bind(Object dataSource, String dataMember)
at Telerik.WinControls.Data.RadListSource`1.set_DataSource(Object value)
at Telerik.WinControls.UI.GridViewTemplate.set_DataSource(Object value)
at BugReproduction.ControlContainingGridView.set_DataSource(Object value) in ...\BugReproduction\BugReproduction\ControlContainingGridView.cs:line 42
How to reproduce public partial class Form1 : RadForm { public Form1() { InitializeComponent(); GridViewTextBoxColumn textBoxColumn = new GridViewTextBoxColumn(); textBoxColumn.Name = "Column"; textBoxColumn.HeaderText = "Column"; this.radGridView1.MasterTemplate.Columns.Add(textBoxColumn); GridViewTextBoxColumn textBoxColumn2 = new GridViewTextBoxColumn(); textBoxColumn2.Name = "TextBoxColumn2"; textBoxColumn2.HeaderText = "ReadOnlyColumn"; this.radGridView1.MasterTemplate.Columns.Add(textBoxColumn2); for (int i = 0; i < 10; i++) { object v = i * 2; if (i % 3 == 0) { v = null; } this.radGridView1.Rows.Add(new object[] { i, v }); } this.radGridView1.MultiSelect = true; foreach (var row in this.radGridView1.Rows) { foreach (var cell in row.Cells) { GridViewCellInfo cellInfo = cell as GridViewCellInfo; if (cellInfo != null && cellInfo.RowInfo.Index % 3 == 0 && cellInfo.ColumnInfo.Index == 1) { cellInfo.ReadOnly = true; } } } } } Workaround: public class MyRadGridView : RadGridView { public override string ThemeClassName { get { return typeof(RadGridView).FullName; } } protected override RadGridViewElement CreateGridViewElement() { return new MyRadGridViewElement(); } } internal class MyRadGridViewElement : RadGridViewElement { protected override Type ThemeEffectiveType { get { return typeof(RadGridViewElement); } } protected override MasterGridViewTemplate CreateTemplate() { return new MyMasterGridViewTemplate(); } } internal class MyMasterGridViewTemplate : MasterGridViewTemplate { protected override void PasteDataToRow(List<string> rowData, GridViewRowInfo row) { { int colIndex = this.Owner.CurrentColumn.Index; int j = 0; while (j < rowData.Count && colIndex < this.CurrentView.ViewTemplate.ColumnCount) { GridViewColumn col = this.CurrentView.ViewTemplate.Columns[colIndex]; if (col.IsVisible && !col.ReadOnly && !row.Cells[colIndex].ReadOnly) { object value = rowData[j]; if (string.IsNullOrEmpty(rowData[j])) { value = null; } else if (this.CurrentView.ViewTemplate.Columns[colIndex].DataType == typeof(string)) { GridViewTextBoxColumn textColumn = col as GridViewTextBoxColumn; if (textColumn != null && textColumn.MaxLength > 0) { if (rowData[j].Length > textColumn.MaxLength) { value = rowData[j].Substring(0, textColumn.MaxLength); } } } else if (this.CurrentView.ViewTemplate.Columns[colIndex].DataType == typeof(DateTime)) { try { value = DateTime.Parse(rowData[j], this.CurrentView.ViewTemplate.Columns[colIndex].FormatInfo); } catch { } } else if (this.CurrentView.ViewTemplate.Columns[colIndex].DataType == typeof(Color)) { try { value = ColorTranslator.FromHtml(rowData[j]); } catch { } } if (this.ClipboardPasteMode == GridViewClipboardPasteMode.EnableWithNotifications) { CellValidatingEventArgs cellValidating = new CellValidatingEventArgs(row, col, value, row.Cells[colIndex].Value, null); this.EventDispatcher.RaiseEvent<CellValidatingEventArgs>(EventDispatcher.CellValidating, this, cellValidating); if (!cellValidating.Cancel) { row.Cells[colIndex].Value = value; CellValidatedEventArgs cellValidated = new CellValidatedEventArgs(row, col, value); this.EventDispatcher.RaiseEvent<CellValidatedEventArgs>(EventDispatcher.CellValidated, this, cellValidated); } } else { row.Cells[colIndex].Value = value; } j++; } colIndex++; } } } }