When the excel-like filtering is enabled, the user should be allowed to change the context menu by subscribing for the corresponding event that allows replacing the menu.
When you add new row to RadGridView and it does not obey the filtering condition, the scroll bar is updated incorrectly.
To reproduce:
-add RadGridView and enable excel-like filtering;
-apply Windows7 theme
When clicking on the filter button, the filter-dialog that shows is not really wide enough, it cuts the Cancel-button.
Workaround:
this.radGridView1.FilterPopupInitialized += radGridView1_FilterPopupInitialized;
private void radGridView1_FilterPopupInitialized(object sender,
Telerik.WinControls.UI.FilterPopupInitializedEventArgs e)
{
e.FilterPopup.PopupOpening -= FilterPopup_PopupOpening;
e.FilterPopup.PopupOpening += FilterPopup_PopupOpening;
}
private void FilterPopup_PopupOpening(object sender, CancelEventArgs args)
{
RadListFilterPopup popup = sender as RadListFilterPopup;
Padding currentPadding = popup.ButtonsMenuItem.Padding;
popup.ButtonsMenuItem.Padding = new Padding(currentPadding.Left,
currentPadding.Top, 20, currentPadding.Bottom);
}
Description: hover the last row bottom border in such a way to display re-sizing cursor. Then move the cursor downwards. The problem occurs only when you have a few rows and move the cursor to the blank side of the grid view. To reproduce: -add RadGridView and use the following code: private void Form1_Load(object sender, EventArgs e) { this.customersTableAdapter.Fill(this.nwindDataSet.Customers); foreach (DataColumn column in this.nwindDataSet.Customers.Columns) { this.radGridView1.Columns.Add(column.ColumnName); } object[] row = this.nwindDataSet.Customers.Rows[0].ItemArray; this.radGridView1.Rows.Add(row); this.radGridView1.SelectedRows[0].IsSelected = false; this.radGridView1.CurrentCell.IsCurrent = false; this.radGridView1.CurrentRow.IsCurrent = false; } Workaround: public Form1() { InitializeComponent(); this.radGridView1.GridBehavior = new MyBaseBehavior(); } public class MyBaseBehavior : BaseGridBehavior { public override bool OnMouseMove(MouseEventArgs e) { GridRowElement currentRow = this.RowAtPoint; if (currentRow == null && e.Button == MouseButtons.None && Cursor.Current != Cursors.Default) { Cursor.Current = Cursors.Default; } return base.OnMouseMove(e); } }
To reproduce: -add RadDock with ToolWindow; -add RadGridView inside the ToolWindow; -apply Office2010Blue theme to the entire application; By default the GridDataCellElement has Font Segoe UI, 8.25pt with blue fore color. When the ToolWindow is floating, GridDataCellElement's font is changed to Microsoft Sans Serif, 8.25pt with black fore color. Workaround: customize the theme by setting the appropriate font and fore color to the GridDataCellElement for the necessary element states.
To reproduce: - add RadGridView with several columns and rows and export the grid to pdf file. - open the exported PDF file with Foxit Reader version 2.2. The opened file is blank.
To reproduce:
- add a RadGridView with one column - GridViewMultiComboBoxColumn;
- set DataSource property of the column;
- subscribe to the CellValidating and use the following code:
private void radGridView1_CellValidating(object sender, CellValidatingEventArgs e)
{
e.Cancel = true;
}
Run the application and select a value from the GridViewMultiComboBoxColumn. When pressing Enter key, InvalidCastException is thrown.
Workaround:
radGridView1.EditorManager.CloseEditorWhenValidationFails = true;
To reproduce:
- add RadGridView and use the following code:
public Form1()
{
InitializeComponent();
DataTable source = new DataTable();
string colName = string.Empty;
for (var i = 0; i < 10; i++)
{
colName = "col" + i.ToString();
this.Grid.Columns.Add(new GridViewTextBoxColumn(colName));
source.Columns.Add(new DataColumn(colName));
}
this.Grid.DataSource = source;
}
- Run the project, click over the grid and press PageUp key. As a result NullReferenceException is thrown.
Workaround: use custom BaseGridBehavior:
this.radGridView1.GridBehavior = new CustomGridBehavior();
public class CustomGridBehavior : BaseGridBehavior
{
protected override bool ProcessPageUpKey(KeyEventArgs keys)
{
GridTableElement tableElement = (GridTableElement)this.GridViewElement.CurrentView;
GridViewRowInfo firstScrollableRow = GetFirstScrollableRow(tableElement, true);
RadScrollBarElement scrollBar = tableElement.VScrollBar;
if (this.GridViewElement.CurrentRow == firstScrollableRow && firstScrollableRow!=null)
{
int height = (int)tableElement.RowScroller.ElementProvider.GetElementSize(firstScrollableRow).Height;
int newValue = scrollBar.Value - scrollBar.LargeChange + height + tableElement.RowScroller.ScrollOffset;
scrollBar.Value = Math.Max(newValue, scrollBar.Minimum);
tableElement.UpdateLayout();
firstScrollableRow = GetFirstScrollableRow(tableElement, false);
}
this.GridViewElement.Navigator.SelectRow(firstScrollableRow);
this.NavigateToPage(firstScrollableRow, keys.KeyData);
return true;
}
}
To reproduce: -add a RadGridView and a RadButton; use the following code: public Form1() { InitializeComponent(); //Create a child template GridViewTemplate childTemplate = new GridViewTemplate(); childTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; this.radGridView1.Templates.Add(childTemplate); GridViewRelation relation = new GridViewRelation(); relation.ChildTemplate = childTemplate; relation.ParentTemplate = this.radGridView1.MasterTemplate; relation.ChildColumnNames.Add("B1"); relation.ParentColumnNames.Add("A1"); this.radGridView1.Relations.Add(relation); } private DataTable dtParent; private DataTable dtChild; private void Form1_Load(object sender, EventArgs e) { //Add data dtParent = new DataTable(); dtParent.Columns.AddRange(new DataColumn[] { new DataColumn("A1") }); dtChild = new DataTable(); dtChild.Columns.AddRange(new DataColumn[] { new DataColumn("B1"), new DataColumn("B2") }); DataRow dr = dtParent.NewRow(); dr["A1"] = "0"; dtParent.Rows.Add(dr); for (int i = 0; i < 40; i++) { DataRow drChild = dtChild.NewRow(); drChild["B1"] = "0"; drChild["B2"] = ""; dtChild.Rows.Add(drChild); } this.radGridView1.MasterTemplate.DataSource = dtParent; this.radGridView1.Templates[0].DataSource = dtChild; } private void radButton1_Click(object sender, EventArgs e) { DataRow drNew = this.dtChild.NewRow(); drNew["B1"] = "0"; drNew["B2"] = "New"; this.dtChild.Rows.Add(drNew); }
If you expand the first parent row and scroll down to the last child row, clicking over the button does not refresh the vertical scroll-bar correctly. The new row shows only half. You can not scroll to the end.
Workaround: refresh the vertical scroll-bar manually: private void radButton1_Click(object sender, EventArgs e) { DataRow drNew = this.dtChild.NewRow(); drNew["B1"] = "0"; drNew["B2"] = "New"; this.dtChild.Rows.Add(drNew); int val = radGridView1.TableElement.VScrollBar.Value; foreach (GridViewRowInfo row in radGridView1.Rows) { if (row.IsExpanded) { val = radGridView1.TableElement.VScrollBar.Value; row.IsExpanded = false; row.IsExpanded = true; radGridView1.TableElement.VScrollBar.Value = val; } } }
To reproduce:
-add a RadGridView and a RadButton;
Use the following code:
public Form1() { InitializeComponent(); List<Item> list = new List<Item>() { new Item(1, "<AUD#F-DC>") }; radGridView1.DataSource = list; } public class Item { public int ID { get; set; } public string Title { get; set; } public Item(int iD, string title) { this.ID = iD; this.Title = title; } } private void Form1_Load(object sender, EventArgs e) { this.employeesTableAdapter.Fill(this.nwindDataSet.Employees); } private void radButton1_Click(object sender, EventArgs e) { ExportToPDF pdfExporter = new ExportToPDF(this.radGridView1); pdfExporter.PdfExportSettings.Title = "My PDF Title"; pdfExporter.PdfExportSettings.PageWidth = 297; pdfExporter.PdfExportSettings.PageHeight = 210; pdfExporter.PageTitle = "temp"; pdfExporter.FitToPageWidth = true; pdfExporter.SummariesExportOption = SummariesOption.ExportAll; pdfExporter.ExportVisualSettings = true; try { pdfExporter.RunExport(@"..\..\..\pdfExport.pdf"); } catch (IOException ex) { RadMessageBox.Show(this, ex.Message, "I/O Error", MessageBoxButtons.OK, RadMessageIcon.Error); } }
Workaround:
pdfExporter.HTMLCellFormatting += pdfExporter_HTMLCellFormatting;
private void pdfExporter_HTMLCellFormatting(object sender, HTMLCellFormattingEventArgs e) { string val = e.HTMLCellElement.Value; e.HTMLCellElement.Value = val.Replace("<", "<").Replace(">", ">"); }
To reproduce:
- add RadGridView and use the following code:
public Form1()
{
InitializeComponent();
List<ColorItem> list = new List<ColorItem>();
List<Color> colors = new List<Color>()
{
Color.Red,
Color.Black,
Color.Blue,
Color.Pink,
Color.Green,
Color.Yellow,
Color.Purple,
Color.Aqua,
Color.Orange,
Color.Fuchsia
};
for (int i = 0; i < 10; i++)
{
list.Add(new ColorItem(i, colors[i], colors[i].Name));
}
radGridView1.DataSource = list;
radGridView1.CellValidating += radGridView1_CellValidating;
}
private void radGridView1_CellValidating(object sender, CellValidatingEventArgs e)
{
if (e.ActiveEditor is GridColorPickerEditor && (Color)e.Value == Color.Aqua)
{
e.Cancel = true;
}
}
Steps:
1. Select the "Color" column of a certain cell and activate the editor;
2. Select Color.Aqua and press Tab to close the currently active GridColorPickerEditor;
As a result InvalidCastException is thrown.
Workaround: use a custom editor derivative of BaseGridEditor:
radGridView1.EditorRequired += radGridView1_EditorRequired;
private void radGridView1_EditorRequired(object sender, EditorRequiredEventArgs e)
{
if (e.EditorType == typeof(GridColorPickerEditor))
{
e.Editor = new CustomColorEditor();
}
}
public class CustomColorEditor : BaseGridEditor
{
TypeConverter converter = TypeDescriptor.GetConverter(typeof(Color));
protected override Telerik.WinControls.RadElement CreateEditorElement()
{
return new GridColorPickerElement();
}
public override object Value
{
get
{
GridColorPickerElement editorElement = this.EditorElement as GridColorPickerElement;
return editorElement.GetColorValue();
}
set
{
GridColorPickerElement editorElement = this.EditorElement as GridColorPickerElement;
if (value is Color)
{
editorElement.SetColorValue((Color)value);
}
else if (value is string)
{
editorElement.SetColorValue((Color)converter.ConvertFromString((string)value));
}
}
}
}
To reproduce:
-add RadGridView and use the following code: public Form1() { InitializeComponent(); radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; radGridView1.AddNewRowPosition = SystemRowPosition.Bottom; radGridView1.Columns.Add("A"); radGridView1.Columns.Add("B"); radGridView1.Columns.Add("C"); radGridView1.CellValidating += radGridView1_CellValidating; } void radGridView1_CellValidating(object sender, CellValidatingEventArgs e) { if ((string)e.Value == "11") { e.Cancel = true; } } Follow the steps: 1. First go to A and enter some value, hit TAB and go to B and enter some value. 2. Hit TAB and move to C. 3. Enter "11". 4. Hit TAB. Validation fails, but the new row is entered (calling radGridView1_RowValidating and ignoring e.Cancel = true; of radGridView1_CellValidating) 5. The erroneous value is copied to Column C in the new "new row". 6. radGridView1_CellValidating is called again.
Workaround:
BaseGridBehavior gridBehavior = radGridView1.GridBehavior as BaseGridBehavior; gridBehavior.UnregisterBehavior(typeof(GridViewNewRowInfo)); gridBehavior.RegisterBehavior(typeof(GridViewNewRowInfo), new CustomGridNewRowBehavior()); public class CustomGridNewRowBehavior : GridNewRowBehavior { protected override bool ProcessTabKey(KeyEventArgs keys) { GridViewNewRowInfo newRowInfo = (GridViewNewRowInfo)this.GridViewElement.CurrentRow; if (newRowInfo.PinPosition == PinnedRowPosition.Bottom || newRowInfo.RowPosition == SystemRowPosition.Bottom) { FieldInfo fi = this.GridControl.GridBehavior.GetType().GetField("defaultRowBehavior", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); GridRowBehavior rowBehavior = fi.GetValue(this.GridControl.GridBehavior) as GridRowBehavior; MethodInfo mi = rowBehavior.GetType().GetMethod("ProcessTabKey", BindingFlags.NonPublic | BindingFlags.Instance); return (bool)mi.Invoke(rowBehavior, new object[] { keys }); } return base.ProcessTabKey(keys); } }
Description: use RadGridView with a lot of columns (e.g. 50) that the horizontal scroll-bar appears. When exporting to PDF, the columns should be rendered correctly like in RadGridView Multi-Page printing.
To reproduce:
1. Add RadGridView with 3 columns and add summary row
2. When is fired the ViewCellFormatting event, set the Text property of GridSummaryCellElement
3. Run project and text is not visible.
void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e) { GridSummaryCellElement summaryCell = e.CellElement as GridSummaryCellElement; if (summaryCell != null) { if (summaryCell.ColumnInfo.FieldName == "ProductID") { summaryCell.Text = "Total"; } } }
Workaround:
Set FormatString property instead Text
property void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e) { GridSummaryCellElement summaryCell = e.CellElement as GridSummaryCellElement; if (summaryCell != null) { if (summaryCell.ColumnInfo.FieldName == "ProductID") { summaryCell.FormatString = "Total"; } } }
FIX. RadDropDownList - exception when filtering the drop down list with predicate
- load some rows in the grid and enable the multiple selection - hold Control key and click row 1 - while still holding down Control key click row 2 - > now both rows are selected - with the Control key still down click row 2 again At this point row 2 should get deselected, but it remains selected.
FIX. RadGridView- exception when filtering date time column which contains null values
FIX. RadGridView - CompositeFilterDescriptors does not work properly
To reproduce: - Open the Excel Like Filtering demo - Open a the excel like filtering dialog and select Available Filter > Custom - Select Contains in both drop downs and press OK
FIX. RadGridView - seting the HeaderImage of a column in the PropertyBuilder results in Object Reference message