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; }
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
Workaround: handle the KeyDown event of the inner TextBoxControl and manipulate the TextBox.SelectionStart: private void radPropertyGrid1_EditorInitialized(object sender, Telerik.WinControls.UI.PropertyGridItemEditorInitializedEventArgs e) { PropertyGridDropDownListEditor ddlEditor = e.Editor as PropertyGridDropDownListEditor; if (ddlEditor != null) { ddlEditor.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown; BaseDropDownListEditorElement el = ddlEditor.EditorElement as BaseDropDownListEditorElement; el.EditableElement.TextBox.TextBoxItem.TextBoxControl.KeyDown -= el_KeyDown; el.EditableElement.TextBox.TextBoxItem.TextBoxControl.KeyDown += el_KeyDown; } } private void el_KeyDown(object sender, KeyEventArgs e) { TextBox tb = sender as TextBox; if (e.KeyData == Keys.Left && tb.SelectionStart > 0) { tb.SelectionStart = --tb.SelectionStart; } if (e.KeyData == Keys.Right && tb.SelectionStart <= tb.Text.Length) { tb.SelectionStart = ++tb.SelectionStart; } }
1. Create new project with RadGridView and setup hierarchy with multiple tabs. 2. Run the project. 3. Open a child view tab and start editing a filter cell. 4. While the editor is open, change the active tab. 5. Repeat this operation several times. Workaround: the issue appears because RadGridView does not close its editor when changing the tab page and it thinks that it is still in edit mode when selecting the old page. You can work around the issue by using a custom cell element. Consider the code below: public class CustomDetailsCellElement : GridDetailViewCellElement { public CustomDetailsCellElement(GridViewColumn column, GridRowElement row) : base(column, row) { } protected override Type ThemeEffectiveType { get { return typeof(GridDetailViewCellElement); } } protected override RadPageViewElement CreatePageViewElement(IRadPageViewProvider pageViewProvider) { RadPageViewElement pageView = base.CreatePageViewElement(pageViewProvider); pageView.ItemSelecting += new EventHandler<RadPageViewItemSelectingEventArgs>(PageViewElement_ItemSelecting); return pageView; } void PageViewElement_ItemSelecting(object sender, RadPageViewItemSelectingEventArgs e) { if (this.IsInValidState(true) && this.GridControl != null && this.GridControl.IsInEditMode) { this.GridControl.EndEdit(); } } } You should handle also the CreateCell event in order to replace default child view cell in RadGridView: void gvReviewMigration_CreateCell(object sender, GridViewCreateCellEventArgs e) { if (e.CellType == typeof(GridDetailViewCellElement)) { e.CellType = typeof(CustomDetailsCellElement); } }
When selecting the child templates from the tree view in the left pane, the preview should be updated to show the child template.
http://screencast.com/t/mZDwbWS8 WORKAROUND: Set the UseCompatibleTextRendering property of RadGridView to false.
If RadGridView is bound to custom objects that implement IComparable<T>, Excel-like filtering does not work. Currently, the issue can be avoided through implementing IComparable instead.
To reproduce: use the following code snippet: Sub New() InitializeComponent() Me.RadGridView1.EnableFiltering = True Me.RadGridView1.ShowHeaderCellButtons = True Dim dt As New DataTable dt.Columns.Add("Id", GetType(Integer)) dt.Columns.Add("Name", GetType(String)) dt.Columns.Add("Type", GetType(String)) dt.Columns.Add("Active", GetType(Boolean)) Dim typeList As New List(Of String) typeList.Add("REFERRAL") typeList.Add("EMPLOYEE") typeList.Add("Type3") typeList.Add("Type4") Dim rand As New Random For index = 1 To 10 dt.Rows.Add(index, "Name" & index, typeList(rand.Next(0, typeList.Count)),If(index mod 2=0, True,false)) Next Me.RadGridView1.AutoGenerateColumns = False Dim decimalColumn As New GridViewDecimalColumn("ID") decimalColumn.FieldName = "Id" RadGridView1.MasterTemplate.Columns.Add(decimalColumn) Dim textBoxColumn As New GridViewTextBoxColumn("Name") textBoxColumn.FieldName = "Name" RadGridView1.MasterTemplate.Columns.Add(textBoxColumn) Dim supplierColumn As GridViewComboBoxColumn = New GridViewComboBoxColumn("Type") supplierColumn.FieldName = "Type" supplierColumn.DataSource = typeList Me.RadGridView1.Columns.Add(supplierColumn) Dim checkBoxColumn As New GridViewCheckBoxColumn("Active") checkBoxColumn.FieldName = "Active" RadGridView1.MasterTemplate.Columns.Add(checkBoxColumn) Me.RadGridView1.DataSource = dt Me.RadGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill End Sub Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click Dim activeFilter As New FilterDescriptor() activeFilter.PropertyName = "Active" activeFilter.Operator = FilterOperator.IsEqualTo activeFilter.Value = True Dim typeFilter As New CompositeFilterDescriptor() typeFilter.FilterDescriptors.Add(New FilterDescriptor("Type", FilterOperator.IsEqualTo, "EMPLOYEE")) typeFilter.FilterDescriptors.Add(New FilterDescriptor("Type", FilterOperator.IsEqualTo, "REFERRAL")) typeFilter.LogicalOperator = FilterLogicalOperator.Or Dim overallFilterDescriptor As New CompositeFilterDescriptor() 'overallFilterDescriptor.PropertyName = "Type" 'overallFilterDescriptor.IsFilterEditor = True overallFilterDescriptor.FilterDescriptors.Add(typeFilter) overallFilterDescriptor.FilterDescriptors.Add(activeFilter) overallFilterDescriptor.LogicalOperator = FilterLogicalOperator.And Me.RadGridView1.FilterDescriptors.Add(overallFilterDescriptor) End Sub Run the project and click the button. You will see that the filter button is not orange indicating that there is applied filter. Additionally, the "Clear filter" option is disabled and the user is not allowed to see the entire data any more. Workaround: set the overall CompositeFilterDescriptor.PropertyName to a specific column and the IsFilterEditor property to true. Thus, you will be allowed to clear the filter from this column.
To reproduce: use the following code snippet and perform the steps illustrated on the attached gif file. radGridView1.Columns.Add(new GridViewTextBoxColumn("A", "A")); radGridView1.Columns.Add(new GridViewTextBoxColumn("B", "B")); radGridView1.Columns.Add(new GridViewTextBoxColumn("C", "C")); radGridView1.Columns.Add(new GridViewTextBoxColumn("D", "D")); radGridView1.Columns.Add(new GridViewTextBoxColumn("E", "E")); radGridView1.Columns.Add(new GridViewTextBoxColumn("F", "F")); radGridView1.Columns[0].Width = 150; radGridView1.Columns[1].Width = 150; radGridView1.Columns[2].Width = 150; radGridView1.Columns[3].Width = 150; radGridView1.Columns[4].Width = 150; radGridView1.Columns[5].Width = 150; radGridView1.Rows.Add("A", "B", "C", "D", "E", "F"); radGridView1.Rows.Add("A", "B", "C", "D", "E", "F"); radGridView1.Rows.Add("A", "B", "C", "D", "E", "F"); radGridView1.Rows.Add("A", "B", "C", "D", "E", "F"); radGridView1.Rows.Add("A", "B", "C", "D", "E", "F"); radGridView1.Rows.Add("A", "B", "C", "D", "E", "F"); radGridView1.Rows.Add("A", "B", "C", "D", "E", "F"); Workaround: private void radGridView1_Resize(object sender, EventArgs e) { if (this.radGridView1.IsInEditMode) { this.radGridView1.EndEdit(); this.radGridView1.BeginEdit(); } } public class CustomGrid : RadGridView { public override string ThemeClassName { get { return typeof(RadGridView).FullName; } } protected override RadGridViewElement CreateGridViewElement() { return new CustomRadGridViewElement(); } } public class CustomRadGridViewElement : RadGridViewElement { protected override Type ThemeEffectiveType { get { return typeof(RadGridViewElement); } } protected override GridViewEditManager CreateEditorManager() { return new CustomGridViewEditManager(this); } } public class CustomGridViewEditManager : GridViewEditManager { public CustomGridViewEditManager(RadGridViewElement gridViewElement) : base(gridViewElement) { } protected override void InitializeEditor(IInputEditor activeEditor) { if (activeEditor == null) { activeEditor = this.GridViewElement.CurrentColumn.GetDefaultEditor(); this.ActiveEditor = activeEditor; } base.InitializeEditor(activeEditor); } }
Deleting a Template in the Property Builder does work.
Workaround: set up the templates from code, http://www.telerik.com/help/winforms/gridview-overview.html
To reproduce: public Form1() { InitializeComponent(); GridViewCheckBoxColumn checkBoxColumn = new GridViewCheckBoxColumn("Select"); checkBoxColumn.EnableHeaderCheckBox = true; radGridView1.MasterTemplate.Columns.Insert(0, checkBoxColumn); for (int i = 0; i < 10; i++) { this.radGridView1.Rows.Add(false); } this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; this.radGridView1.MultiSelect = true; this.radGridView1.HeaderCellToggleStateChanged += radGridView1_HeaderCellToggleStateChanged; } private void radGridView1_HeaderCellToggleStateChanged(object sender, GridViewHeaderCellEventArgs e) { if (e.State.ToString() == "On") this.radGridView1.SelectAll(); else this.radGridView1.ClearSelection(); } Workaround 1: private void radGridView1_HeaderCellToggleStateChanged(object sender, GridViewHeaderCellEventArgs e) { bool selected = e.State.ToString() == "On"; foreach (GridViewRowInfo r in this.radGridView1.Rows) { r.IsSelected = selected; } } Workaround 2: private void radGridView1_MouseUp(object sender, MouseEventArgs e) { RadCheckBoxElement el = this.radGridView1.ElementTree.GetElementAtPoint(e.Location) as RadCheckBoxElement; if (el!=null) { GridCheckBoxHeaderCellElement headerCell = el.Parent as GridCheckBoxHeaderCellElement; bool selected = el.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On; if (headerCell!=null) { if (selected) { this.radGridView1.SelectAll(); } else { this.radGridView1.ClearSelection(); } } } }
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: public Form1() { InitializeComponent(); Random r = new Random(); DataTable table = new DataTable("table1"); table.Columns.Add("ID", typeof(int)); table.Columns.Add("Name", typeof(string)); table.Columns.Add("Bool", typeof(bool)); table.Columns.Add("DateColumn", typeof(DateTime)); for (int i = 0; i < 10; i++) { table.Rows.Add(i, "Row " + i, r.Next(10) > 5 ? true : false, DateTime.Now.AddHours(i)); } DataSet dataSet = new DataSet(); dataSet.Tables.Add(table); radGridView1.DataBindingComplete += radGridView1_DataBindingComplete; this.radGridView1.DataSource = dataSet; this.radGridView1.DataMember = "table1"; } void radGridView1_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e) { }
1. Create a new project with RadGridView. 2. Bind it and set grouping. 3. Add a summary row and set ShowParentGroupSummaries property to true. 4. Handle the ViewCellFormatting event and set all summary rows to be IsVisible = false when the processed cell is GridSummaryCellElement: void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e) { if (e.CellElement is GridSummaryCellElement) { e.Row.IsVisible = false; } } CORRECT WAY TO HANDLE THIS CASE: Hide the summary rows in the groups you want after grouping/data binding. To hide the first bottom summary row of the first group in a RadGridView use the following code: this.radGridView1.Groups[0].GroupRow.BottomSummaryRows[0].IsVisible = false;
Workaround: public partial class Form1: Form { public Form1() { InitializeComponent(); this.radGridView1.GridViewElement.EditorManager = new MyGridViewEditManager(this.radGridView1.GridViewElement); } } public class MyGridViewEditManager : GridViewEditManager { public MyGridViewEditManager(RadGridViewElement gridViewElement) : base(gridViewElement) { } public override bool BeginEdit() { this.GridViewElement.CurrentView.EnsureCellVisible(this.GridViewElement.CurrentCell.RowInfo, this.GridViewElement.CurrentCell.ColumnInfo); this.GridViewElement.CurrentCell.UpdateLayout(); return base.BeginEdit(); } }