Steps to reproduce:
1. Please run the attached sample project
2. Filter grid so only one row is left
3.Copy the first cell with the content menu. The following error occurs:
************** Exception Text ************** System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Telerik.WinControls.UI.MasterGridViewTemplate.CopySelected(GridViewCellInfo[] cells, String format, Boolean cut, Boolean cutOperation, StringBuilder content) in C:\Work\Development\RadControls\RadGridView\Code\Data\MasterGridViewTemplate.cs:line 1491 at Telerik.WinControls.UI.MasterGridViewTemplate.ProcessContent(String format, Boolean cut, Boolean cutOperation) in C:\Work\Development\RadControls\RadGridView\Code\Data\MasterGridViewTemplate.cs:line 1291 at Telerik.WinControls.UI.MasterGridViewTemplate.CopyContent(Boolean cut) in C:\Work\Development\RadControls\RadGridView\Code\Data\MasterGridViewTemplate.cs:line 1256 at Telerik.WinControls.UI.MasterGridViewTemplate.Copy() in C:\Work\Development\RadControls\RadGridView\Code\Data\MasterGridViewTemplate.cs:line 2066 at Telerik.WinControls.UI.GridDataCellElement.ItemCopy_Click(Object sender, EventArgs e) in C:\Work\Development\RadControls\RadGridView\Code\UI\GridViews\TableView\Cells\GridDataCellElement.cs:line 380 at Telerik.WinControls.RadElement.OnClick(EventArgs e) in C:\Work\Development\RadControls\RadControl\TPF\Element\RadElement.cs:line 5096 at Telerik.WinControls.UI.RadButtonItem.OnClick(EventArgs e) in C:\Work\Development\RadControls\RadControlsUI\UIElements\Buttons\RadButtonItem.cs:line 566 at Telerik.WinControls.UI.RadMenuItem.OnClick(EventArgs e) in C:\Work\Development\RadControls\RadControlsUI\Menu\RadMenuItem.cs:line 685 at Telerik.WinControls.RadElement.DoClick(EventArgs e) in C:\Work\Development\RadControls\RadControl\TPF\Element\RadElement.cs:line 5160 at Telerik.WinControls.RadElement.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args) in C:\Work\Development\RadControls\RadControl\TPF\Element\RadElement.cs:line 4274 at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args) in C:\Work\Development\RadControls\RadControl\TPF\Element\RadItem.cs:line 779 at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args) in C:\Work\Development\RadControls\RadControl\TPF\Element\RadElement.cs:line 4181 at Telerik.WinControls.RadElement.DoMouseUp(MouseEventArgs e) in C:\Work\Development\RadControls\RadControl\TPF\Element\RadElement.cs:line 5273 at Telerik.WinControls.RadElement.CallDoMouseUp(MouseEventArgs e) in C:\Work\Development\RadControls\RadControl\TPF\Element\RadElement.cs:line 5495 at Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e) in C:\Work\Development\RadControls\RadControl\TPF\Control\ComponentInputBehavior.cs:line 75 at Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e) in C:\Work\Development\RadControls\RadControl\TPF\Control\RadControl.cs:line 1206 at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at Telerik.WinControls.RadControl.WndProc(Message& m) in C:\Work\Development\RadControls\RadControl\TPF\Control\RadControl.cs:line 1550 at Telerik.WinControls.UI.RadPopupControlBase.WndProc(Message& m) in C:\Work\Development\RadControls\RadControlsUI\GenericPopup\RadPopupControlBase.cs:line 795 at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Use the following code snippet:
public RadForm1()
{
InitializeComponent();
this.radGridView1.Columns.Add("TextColumn");
this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
for (int i = 0; i < 30; i++)
{
this.radGridView1.Rows.Add(Guid.NewGuid().ToString());
}
this.radGridView1.CellValidating += radGridView1_CellValidating;
this.radGridView1.EditorManager.CloseEditorWhenValidationFails = false;
}
private void radGridView1_CellValidating(object sender, CellValidatingEventArgs e)
{
if (e.Value == null || e.Value == "")
{
e.Cancel = true;
RadMessageBox.Show("Value can't be empty!");
}
}
Steps:
1. Clear the value of a cell
2. While the editor is active with an empty value, click the vertical scrollbar to trigger scrolling.
Actual: the scrolling is performed and the editor is closed with the previous value no matter when the validation fails and the CloseEditorWhenValidationFails property is set to false.
Expected: the scrolling should be blocked if the validation fails. We should offer the same behavior when scrolling with the mouse wheel, clicking another cell or clicking the vertical scrollbar (or any of its elements).
Workaround:
public class MyGrid : RadGridView
{
public override string ThemeClassName
{
get
{
return typeof(RadGridView).FullName;
}
}
protected override void OnMouseDown(MouseEventArgs e)
{
RadScrollBarElement scrollBarAtPoint = GetScrollbarElementAtPoint<RadScrollBarElement>(this.GridViewElement.ElementTree, e.Location) as RadScrollBarElement;
GridViewEditManager editManager = this.EditorManager;
if (scrollBarAtPoint != null && this.ActiveEditor != null && !editManager.CloseEditorWhenValidationFails)
{
bool isClosed = editManager.CloseEditor();
if (!isClosed)
{
return;
}
}
base.OnMouseDown(e);
}
internal T GetScrollbarElementAtPoint<T>(RadElementTree componentTree, Point point) where T : RadElement
{
if (componentTree != null)
{
RadElement elementUnderMouse = componentTree.GetElementAtPoint(point);
while (elementUnderMouse != null)
{
T item = elementUnderMouse as T;
if (item != null)
{
return item;
}
elementUnderMouse = elementUnderMouse.Parent;
}
}
return null;
}
}
Use the following code snippet:
public RadForm1()
{
InitializeComponent();
GridViewDecimalColumn idColumn = new GridViewDecimalColumn("Id");
this.radGridView1.Columns.Add(idColumn);
GridViewTextBoxColumn nameColumn = new GridViewTextBoxColumn("Name");
this.radGridView1.Columns.Add(nameColumn);
GridViewDateTimeColumn dateColumn = new GridViewDateTimeColumn("Date");
dateColumn.FilteringMode = GridViewTimeFilteringMode.Date;
dateColumn.Format = DateTimePickerFormat.Custom;
dateColumn.CustomFormat = "dd/MM/yyyy";
dateColumn.FormatString = "{0:dd/MM/yyyy}";
this.radGridView1.Columns.Add(dateColumn);
this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
for (int i = 0; i < 50; i++)
{
this.radGridView1.Rows.Add(i,"Row"+i,DateTime.Now.AddDays(i));
}
this.radGridView1.EnableFiltering = true;
this.radGridView1.ShowHeaderCellButtons = true;
this.radGridView1.ShowFilteringRow = false;
this.radGridView1.FilterExpressionChanged += RadGridView1_FilterExpressionChanged;
}
private void RadGridView1_FilterExpressionChanged(object sender, FilterExpressionChangedEventArgs e)
{
Console.WriteLine(e.FilterExpression);
}
If I use the calendar control then the sequence works:
Click the filter button
Click Available filters
Click Equals
Click the calendar button in the value field
Click on December 10, 2021
But if I do not use the calendar control then it does not work. This sequence produces no results:
Click the filter button
Click Available filters
Click Equals
Click on the day component of the value field
Type in 10
Click OK
Workaround:
private void RadGridView1_CreateCompositeFilterDialog(object sender, GridViewCreateCompositeFilterDialogEventArgs e)
{
e.Dialog = new CustomCompositeDataFilterForm();
}
public class CustomCompositeDataFilterForm : CompositeDataFilterForm
{
protected override void OnClosing(CancelEventArgs e)
{
base.OnClosing(e);
if (GridFilterCellElement.ValidateUserFilter(this.FilterDescriptor))
{
CompositeFilterDescriptor cfd = this.FilterDescriptor as CompositeFilterDescriptor;
if (cfd != null)
{
foreach (FilterDescriptor fd in cfd.FilterDescriptors)
{
TrimTimePart(fd);
}
}
else
{
TrimTimePart(this.FilterDescriptor);
}
}
}
private void TrimTimePart(FilterDescriptor filterDescriptor)
{
CompositeFilterDescriptor cfd = filterDescriptor as CompositeFilterDescriptor;
if (cfd != null)
{
foreach (FilterDescriptor fd in cfd.FilterDescriptors)
{
TrimTimePart(fd);
}
}
else
{
DateTime dateValue = DateTime.MinValue;
if (DateTime.TryParse(filterDescriptor.Value + "", out dateValue))
{
dateValue = dateValue.Date;
filterDescriptor.Value = dateValue;
}
}
}
}
Follow the steps:
1.Group by Description.
2. Expand the groups
3. Sort by Id
4. Try expanding the hierarchical level. You will notice that some of the rows disappear.
Please refer to the attached gif file illustrating the steps for replicating the issue.
There are situations where SelectedRows won't return the number of rows preselected when using Begin/EndUpdate even though it seems like there's a row selected in the UI. By preselected I mean the row that looks selected after the rows has been added. This bug has caused some problems for us because the user tried some action on a row they thought was preselected and it would fail.
One situation I found where this bug can be reproducted is by using SortOrder in combination of Begin/EndUpdate. There are probably more situations but I hope this one will let you find the underlying bug.
The attached project contains a simple form with a RadGridView which will contain a list of persons. The list is populated by this method:
public void PopulateGridView(List<Person> persons)
{
PersonGridView.BeginUpdate();
PersonGridView.DataSource = persons;
PersonGridView.EndUpdate();
PersonGridView.Columns[nameof(Person.LastName)].SortOrder = RadSortOrder.Ascending;
}
There are two buttons: "Step one" and "Step two". The first will mimick a situation where the user search a database for persons and none will be found. By clicking the "Get selected rows" you will see that the SelectedRows will return zero rows which is correct.
But when you afterwards click "Step two" (which will add five rows) it seems like there's one row preselected. I would expect the SelectedRows to return that row but by clicking "Get selected rows" again you will see that the returned rows are zero still. The CurrentRow, however is set to the preselected row as expected.
If you start by clicking "Step two" the SelectedRows actually returns the correct rows. Quite strange :-)
I know this is a very small issue and can be avoided. But as I mentioned there are other situations where this problem occurs and it's quite hard to figure out exactly what causes it.
Thank you for your help.
Best regards
Ulrik Skovenborg
Please run the attached sample project. The row's height in the print document is not adjusted according to the column's width in the print page.
Workaround:
Usually for such cases it is convenient to increase the column's width in order to reduce its height and thus it would be able to fit the print page's height. In addition to adjusting the column's width, feel free to use multi-page printing:
Steps to reproduce:
1. Bind the grid to BindingList
2. Call BestFitColumns method in form's constructor
3. Use Fluent/Crystal theme
4. Rebind the grid by setting DataSource=null
5. Exception is thrown
Stack trace:
en Telerik.WinControls.UI.BestFitHelper.SetColumnWidth(GridViewColumn column, Single desiredWidth) en Telerik.WinControls.UI.BestFitHelper.BestFitColumnCore(GridViewColumn column, BestFitColumnMode mode) en Telerik.WinControls.UI.BestFitHelper.ProcessRequests() en Telerik.WinControls.UI.GridTableElement.UpdateAll() en Telerik.WinControls.UI.GridTableElement.UpdateViewCore(Object sender, DataViewChangedEventArgs args) en Telerik.WinControls.UI.GridTableElement.UpdateView(Object sender, DataViewChangedEventArgs args) en Telerik.WinControls.UI.GridTableElement.ProcessTemplateEvent(GridViewEvent eventData) en Telerik.WinControls.UI.GridTableElement.Telerik.WinControls.UI.IGridViewEventListener.ProcessEvent(GridViewEvent eventData) en Telerik.WinControls.UI.GridViewEventProcessEntity.ProcessCollection(GridViewEvent gridEvent, PriorityWeakReferenceList list, GridEventProcessMode processMode) en Telerik.WinControls.UI.GridViewEventProcessEntity.ProcessEvent(GridViewEvent gridEvent) en Telerik.WinControls.UI.GridViewSynchronizationService.NotifyListeners(GridViewEvent gridEvent) en Telerik.WinControls.UI.GridViewSynchronizationService.FlushEvents() en Telerik.WinControls.UI.GridViewSynchronizationService.DispatchEvent(GridViewEvent gridEvent) en Telerik.WinControls.UI.GridViewSynchronizationService.DispatchEvent(GridViewTemplate template, GridViewEvent eventData, Boolean postUI) en Telerik.WinControls.UI.GridViewTemplate.DispatchEvent(GridViewEvent gridEvent, Boolean postUI) en Telerik.WinControls.UI.GridViewTemplate.DispatchDataViewChangedEvent(Object sender, DataViewChangedEventArgs args) en Telerik.WinControls.UI.GridViewTemplate.OnViewChanged(Object sender, DataViewChangedEventArgs e) en Telerik.WinControls.UI.MasterGridViewTemplate.OnViewChanged(Object sender, DataViewChangedEventArgs e) en Telerik.WinControls.UI.GridViewTemplate.CollectionView_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) en Telerik.WinControls.Data.RadCollectionView`1.OnCollectionChanged(NotifyCollectionChangedEventArgs args) en Telerik.WinControls.Data.RadDataView`1.RebuildData(Boolean notify) en Telerik.WinControls.Data.RadDataView`1.RefreshOverride() en Telerik.WinControls.Data.RadDataView`1.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args) en Telerik.WinControls.Data.RadCollectionView`1.source_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) en Telerik.WinControls.Data.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e) en Telerik.WinControls.Data.RadListSource`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) en Telerik.WinControls.Data.RadListSource`1.EndUpdate(Boolean notifyUpdates) en Telerik.WinControls.Data.RadListSource`1.Initialize() en Telerik.WinControls.Data.RadListSource`1.Bind(Object dataSource, String dataMember) en Telerik.WinControls.Data.RadListSource`1.set_DataSource(Object value) en Telerik.WinControls.UI.GridViewTemplate.set_DataSource(Object value) en Telerik.WinControls.UI.RadGridView.set_DataSource(Object value)
Please refer to the attached sample project.
If the main Cars list is not empty, the child templates have correct captions:
However, if initially there are no Cars and you add a new one via the new row, the captions of the child template remains with the default value ("table"):
Hi
Please find attached sample project having 2 different reference folder(Telerik2018,Telerik2020) for Telerik.
Code flow & Issue description: I have Event "radGridView1_EditorRequired" in which i have attached another event on value changed "Editor_ValueChanged" in which we get data gron DropdownListElement using ((RadDropDownListElement)(sender)).SelectedValue.
Issue is when we use version (2018.3.1016.40) we get selected value text, in case of current version (2020.1.218.40) we get null value.
Current version DLL 2020.1.218.40 (Issue in current version)
Previous version DLL 2018.3.1016.40 (Working fine)
Note : I have also attached both version of Telerik DLL in sample project, you can reproduce issue by referencing to 2020.1.218.40 version. After selecting values as shown in attached screenshot you will get null value as shown in another screenshot.
Please find attached screenshot for selecting values to reproduce issue as well where we get null value.
Thanks and Regards
I have a radGridView with MutliSelect set to true and SelectionMode set to FullRowSelect. A theme is applied, and this behavior is seen with other themes too. Several columns are pinned to the left.
When I multi-select rows using the shift or control buttons by clicking one of the cells under the frozen columns, the row is selected and colored accordingly, except for the cell that was actually clicked which remains with the unselected color.
If I multi-select by clicking on one of the cells under an unpinned column, the full row is selected as expected.
In the image below, I held down shift and selected the first and third row in sequence under the Officer column.
How can I fix this to show the complete row selected?
Please refer to the attached sample project. When the expander is in the columns that contains long text that has be resize the rows, the AutoSizeRows functionality doesn't work properly:
Workaround: set the MasterTemplate.SelfReferenceExpanderColumn property to a column that contains very short content:
Me.RadGridView1.MasterTemplate.SelfReferenceExpanderColumn = Me.RadGridView1.Columns(1)
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
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.