It would be great if multi-page printing is supported for grids with ColumnGroupsViewDefinition and HtmlViewDefinition.
To reproduce: - Add checkbox column to a grid and enable filtering. - Filter on other column so there are no rows visible. - The header cell checkbox is checked automatically. Workaround: void radGridView_CreateCell(object sender, GridViewCreateCellEventArgs e) { if (e.CellType == typeof(GridCheckBoxHeaderCellElement)) { e.CellElement = new GridCheckBoxHeaderCellElement(e.Column,e.Row); ((GridCheckBoxHeaderCellElement)e.CellElement).CheckBox.ToggleStateChanging += CheckBox_ToggleStateChanging; } } void CheckBox_ToggleStateChanging(object sender, StateChangingEventArgs args) { if (radDevices.ChildRows.Count == 0) { args.Cancel = true; } }
To reproduce: public Form1() { InitializeComponent(); GridViewDecimalColumn decimalColumn = new GridViewDecimalColumn("DecimalColumn"); decimalColumn.FormatString = "{0:N0}"; decimalColumn.FieldName = "Price"; radGridView1.MasterTemplate.Columns.Add(decimalColumn); GridViewCommandColumn commandColumn = new GridViewCommandColumn("CommandColumn"); commandColumn.FormatString = "{0:N0}"; commandColumn.FieldName = "Price"; radGridView1.MasterTemplate.Columns.Add(commandColumn); radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; this.radGridView1.SaveLayout(@"..\..\..\layout.xml"); this.radGridView1.LoadLayout(@"..\..\..\layout.xml"); FillData(); } private void FillData() { List<Item> items = new List<Item>(); for (int i = 0; i < 5; i++) { items.Add(new Item(i * 2.35m)); } radGridView1.DataSource = items; } public class Item { public decimal Price { get; set; } public Item(decimal price) { this.Price = price; } } Workaround: use the CellFormatting event and format the GridCommandCellElement.CommandButton.Text property: private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) { if (e.Column is GridViewCommandColumn && e.CellElement.Value != null) { GridCommandCellElement commandCell = e.CellElement as GridCommandCellElement; commandCell.CommandButton.Text = string.Format("{0:N0}", e.CellElement.Value); } }
To reproduce: - Set the column like this: GridViewMaskBoxColumn col = new GridViewMaskBoxColumn(); col.Mask = "&&&&&&&&&&"; col.MaskType = MaskType.Standard; col.FieldName = "Name"; col.TextMaskFormat = MaskFormat.IncludeLiterals; - Type two words and press enter. Workaround: public class MyRadMaskedEditBoxEditor : RadMaskedEditBoxEditor { public override object Value { get { if (this.MaskTextBox.Mask == "my mask") { return this.MaskTextBox.Value; } return base.Value; } set { base.Value = value; } } }
To reproduce: - Open the Search Row sample in the demo application. - Type some text in the search textbox. - Using the context menu of the search textbox add some unicode control characters.
To reproduce, use the following code and afterwards check the CurrentRow.Index property: this.grid.BeginUpdate(); GridViewDataRowInfo newRow = new GridViewDataRowInfo(grid.MasterView); this.grid.Rows.Add(newRow); this.grid.EndUpdate(); Workaround: radGridView1.Rows.IndexOf(radGridView1.CurrentRow);
To reproduce: - Create a custom column that uses RadTextBoxControlElement as permanent editor. - Add the column to the grid. - Scroll the grid so the custom column is not visible. - Put the the grid in edit mode and change the current cell. Workaround: - Disable the IME support: public class MyRadTextBoxControlElement : RadTextBoxControlElement { protected override Type ThemeEffectiveType { get { return typeof(RadTextBoxControlElement); } } protected override void OnLoaded() { this.InvalidateMeasure(); } }
The issue appears when selecting multiple cells using mouse drag outside of the bounds of the control. Add a large number of columns (100) and a few rows, press the first cell and drag quickly as far to the right as possible. When you scroll back and check the selection, you will see that some cells are not selected.
To reproduce: - Enable the search row in the 50000 rows example. - Set the 5 last rows RowIndex value to null. - Set the filter of the RowIndex column to "Is null" and then to "Is not null" - Type 499 in the search row. - Set the filter of the RowIndex column to "Is null" and then to "Is not null" again. Workaround: public class MyGridViewSearchRowInfo : GridViewSearchRowInfo { public MyGridViewSearchRowInfo(GridViewInfo viewInfo) : base(viewInfo) { } protected override int GetCurrentCellTraverserColumnIndex() { if (this.ViewTemplate.MasterTemplate.Owner.CurrentRow == null) { return -1; } return base.GetCurrentCellTraverserColumnIndex(); } } //change the row like this: void radGridViewDemo_CreateRowInfo(object sender, GridViewCreateRowInfoEventArgs e) { if (e.RowInfo is GridViewSearchRowInfo) { e.RowInfo = new MyGridViewSearchRowInfo(e.ViewInfo); } }
private void radGridView1_CellEditorInitialized(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e) { GridColorPickerEditor colorEditor = e.ActiveEditor as GridColorPickerEditor; if (colorEditor!=null) { GridColorPickerElement colorPicker = colorEditor.EditorElement as GridColorPickerElement; colorPicker.ReadOnly = true; } } Please refer to the attached gif file. Workaround: private void radGridView1_EditorRequired(object sender, EditorRequiredEventArgs e) { if (e.EditorType == typeof(GridColorPickerEditor)) { e.Editor = new GridColorPickerEditor(); } }
Please refer to the attached gif file. Workaround: this.radGridView1.GridBehavior = new CustomBaseGridBehavior(); public class CustomBaseGridBehavior : BaseGridBehavior { public override bool OnMouseMove(MouseEventArgs e) { GroupPanelSizeGripElement grip = this.GridViewElement.ElementTree.GetElementAtPoint(e.Location) as GroupPanelSizeGripElement; if (grip != null) { this.GridViewElement.ElementTree.Control.Cursor = Cursors.SizeNS; return true; } return base.OnMouseMove(e); } }
To reproduce, use this code: AddGrid(); List<DropDownObject> lstDrp = new List<DropDownObject>(); DropDownObject drpObj = new DropDownObject(); drpObj.DropdownValue = "100"; drpObj.DropdownValueID = 1; DropDownObject drpObj2 = new DropDownObject(); drpObj2.DropdownValue = "100"; drpObj2.DropdownValueID = 2; DropDownObject drpObj1 = new DropDownObject(); drpObj1.DropdownValue = "101"; drpObj1.DropdownValueID = 1; lstDrp.Add(drpObj); lstDrp.Add(drpObj2); lstDrp.Add(drpObj1); DataTable dtMain = new DataTable(); DataColumn dcDropCol = new DataColumn(); dcDropCol.ColumnName = "DropDown Col"; dcDropCol.DataType = typeof(System.Int32); dtMain.Columns.Add(dcDropCol); DataRow dr = dtMain.NewRow(); dr["DropDown Col"] = 100; dtMain.Rows.Add(dr); var uniqueDropdownValues = lstDrp.GroupBy(s => s.DropdownValue).Select(s => s.First()); GridViewComboBoxColumn drpCol = new GridViewComboBoxColumn(); radGridView1.Columns.Add(drpCol); //first add the column //drpCol.DataType = typeof(int); //then change its data type to change the filtering type from string to int drpCol.Name = "DropDown Col"; drpCol.HeaderText = "Dropdown Col"; drpCol.FieldName = "Dropdown Col"; drpCol.DataSource = uniqueDropdownValues; drpCol.ValueMember = "DropdownValue"; drpCol.DisplayMember = "DropdownValue"; drpCol.Width = 200; drpCol.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown; drpCol.AutoCompleteMode = AutoCompleteMode.SuggestAppend; drpCol.AllowFiltering = true; radGridView1.EnableFiltering = true; radGridView1.ShowHeaderCellButtons = true; radGridView1.DataSource = dtMain; radGridView1.AllowAddNewRow = true;
It takes more than a minute to export 15000 cells. To reproduce: public Form1() { InitializeComponent(); //populate with data DataTable dt = new DataTable(); for (int i = 0; i < 50; i++) { dt.Columns.Add("Col" + i, typeof(string)); } DataColumn col; for (int i = 0; i < 3000; i++) { DataRow newRow = dt.Rows.Add(); for (int j = 0; j < dt.Columns.Count; j++) { col = dt.Columns[j]; newRow[col.ColumnName] = "Data." + i + " " + dt.Columns.IndexOf(col); } } this.radGridView1.DataSource = dt; this.radGridView1.BestFitColumns(Telerik.WinControls.UI.BestFitColumnMode.AllCells); } private void radButton1_Click(object sender, EventArgs e) { Telerik.WinControls.UI.Export.SpreadExport.SpreadExport spreadExporter; spreadExporter = new SpreadExport(this.radGridView1,SpreadExportFormat.Xlsx ); spreadExporter.ExportVisualSettings = false; SaveFileDialog dialog = new SaveFileDialog(); dialog.FilterIndex = 1; dialog.DefaultExt = "*.xlsx"; dialog.Filter = "Excel file |*.xlsx"; if (dialog.ShowDialog() == DialogResult.OK) { Stopwatch sw = new Stopwatch(); sw.Start(); string fileName = dialog.FileName; spreadExporter.RunExport(fileName); sw.Stop(); Console.WriteLine(string.Format("Elapsed {0}", sw.Elapsed)); Process.Start(fileName); } }
If a RadGridView instance is not disposed explicitly and it is left for the finalizer to dispose, a null reference exception will be thrown. This can happen if the grid is not in the control tree of a form. The exception is caused by the fact that the SelfReferenceDataProvider is disposed twice in this case.
To reproduce: public Form1() { InitializeComponent(); ColumnGroupsViewDefinition view = 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(this.radGridView1.Columns["CompanyName"]); view.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["ContactName"]); view.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["ContactTitle"]); view.ColumnGroups[1].Groups[0].Rows.Add(new GridViewColumnGroupRow()); view.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["Address"]); view.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["City"]); view.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["Country"]); view.ColumnGroups[1].Groups[1].Rows.Add(new GridViewColumnGroupRow()); view.ColumnGroups[1].Groups[1].Rows[0].Columns.Add(this.radGridView1.Columns["Phone"]); view.ColumnGroups[1].Groups[1].Rows[0].Columns.Add(this.radGridView1.Columns["Fax"]); radGridView1.ViewDefinition = view; radGridView1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; view.ColumnGroups[0].PinPosition = PinnedColumnPosition.Left; } Please see the attached screenshot. Workaround: add the columns belonging to the pinned group in a reversed order.
To reproduce: private void Form1_Load(object sender, EventArgs e) { this.productsTableAdapter.Fill(this.nwindDataSet.Products); this.categoriesTableAdapter.Fill(this.nwindDataSet.Categories); radGridView1.DataSource = nwindDataSet.Categories; radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; GridViewTemplate template = new GridViewTemplate(); template.DataSource = nwindDataSet.Products; template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; radGridView1.MasterTemplate.Templates.Add(template); GridViewRelation relation = new GridViewRelation(radGridView1.MasterTemplate); relation.ChildTemplate = template; relation.RelationName = "CategoriesProducts"; relation.ParentColumnNames.Add("CategoryID"); relation.ChildColumnNames.Add("CategoryID"); radGridView1.Relations.Add(relation); this.radGridView1.CurrentRow = this.radGridView1.MasterTemplate.Templates.First().Rows[this.radGridView1.MasterTemplate.Templates.First().Rows.Count - 1]; } Workaround: this.radGridView1.MasterTemplate.ExpandAll(); this.radGridView1.MasterTemplate.CollapseAll(); this.radGridView1.CurrentRow = this.radGridView1.MasterTemplate.Templates.First().Rows[this.radGridView1.MasterTemplate.Templates.First().Rows.Count - 1]; Another scenario: if you try to add a new row to the child template on the RadButton.Click event and call the EnsureVisible(true) method, it will not affect the grid, until you expand/collapse the parent row: private void radButton1_Click(object sender, EventArgs e) { //add the new row to the child template DataRow newRow = this.nwindDataSet.Products.Rows.Add(); newRow["CategoryID"] = 3; newRow["ProductName"] = "NewProduct"; this.radGridView1.CurrentRow = this.radGridView1.MasterTemplate.Templates.First().Rows[this.radGridView1.MasterTemplate.Templates.First().Rows.Count - 1]; this.radGridView1.CurrentRow.EnsureVisible(true); } Workaround: private void radButton1_Click(object sender, EventArgs e) { //keep expanded rows List<GridViewRowInfo> expandedRows = new List<GridViewRowInfo>(); foreach (GridViewRowInfo row in this.radGridView1.Rows) { if (row.IsExpanded) { expandedRows.Add(row); } } //add the new row to the child template DataRow newRow = this.nwindDataSet.Products.Rows.Add(); newRow["CategoryID"] = 3; newRow["ProductName"] = "NewProduct"; //refresh the rows this.radGridView1.MasterTemplate.ExpandAll(); this.radGridView1.MasterTemplate.CollapseAll(); foreach (GridViewRowInfo rowToExpand in expandedRows) { rowToExpand.IsExpanded = true; } this.radGridView1.CurrentRow = null; this.radGridView1.CurrentRow = this.radGridView1.MasterTemplate.Templates.First().Rows[this.radGridView1.MasterTemplate.Templates.First().Rows.Count - 1]; this.radGridView1.CurrentRow.EnsureVisible(true); }
i would like to customize the grid like below attached screen shot,is it possible using telerik win forms (rad grid view), if possible can you please send me sample code for that, if not possible can you suggest me alternate solution for this requirement.
To reproduce: - Bind the grid to a data source and set its RightToLeftProperty to true. Note: use Visual Studio 2008 under Windows XP with .NET 2.0 Workaround: Private Sub RadGridView1_ViewCellFormatting(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.CellFormattingEventArgs) If RadGridView1.RightToLeft = Windows.Forms.RightToLeft.Yes Then e.CellElement.TextAlignment = ContentAlignment.MiddleLeft End If End Sub
Workaround: RadImageShape hint; protected override void OnLoad(EventArgs e) { base.OnLoad(e); InitializeComponent(); hint = radGridView1.TableElement.RowDragHint; new Windows7Theme(); radGridView1.ThemeName = "Windows7"; radGridView1.TableElement.RowDragHint = hint; }