The DataType property is not implemented in the designer. Currently you could set this property only by code.
To reproduce: BindingList<Item> items = new BindingList<Item>(); public Form1() { InitializeComponent(); Item dataItem1 = new Item(1); dataItem1.Name = "Cat"; dataItem1.GroupName = "Animal"; dataItem1.GroupSortPriority = 2; items.Add(dataItem1); Item dataItem2 = new Item(2); dataItem2.Name = "Kitten"; dataItem2.GroupName = "Animal"; dataItem2.GroupSortPriority = 2; dataItem2.ParentIndex = 1; items.Add(dataItem2); Item dataItem3 = new Item(3); dataItem3.Name = "Trout"; dataItem3.GroupName = "Fish"; dataItem3.GroupSortPriority = 1; items.Add(dataItem3); radGridView1.Relations.AddSelfReference(radGridView1.MasterTemplate, "Index", "ParentIndex"); radGridView1.DataSource = items; } private void ExpandSomeGroups() { foreach (DataGroup group in radGridView1.Groups) { if (group.GroupRow.HeaderText.Contains("Animal")) { if (group.IsExpanded) { group.Collapse(false); } else { group.Expand(true); } } } } public class Item { public Item(int index) { Index = index; } public int Index { get; private set; } public int ParentIndex { get; set; } public string Name { get; set; } public string GroupName { get; set; } public int GroupSortPriority { get; set; } } private void Form1_Load(object sender, EventArgs e) { GroupDescriptor descriptor = new GroupDescriptor(); descriptor.GroupNames.Add("GroupName", ListSortDirection.Ascending); radGridView1.GroupDescriptors.Add(descriptor); ExpandSomeGroups(); } You will notice that the "Animal" group is not expanded. However, if you remove the self-referencing hierarchy, the "Animal" group will be expanded.
To reproduce: public Form1() { InitializeComponent(); GridViewDecimalColumn idColumn = new GridViewDecimalColumn("ID"); radGridView1.MasterTemplate.Columns.Add(idColumn); GridViewDecimalColumn parentIdColumn = new GridViewDecimalColumn("ParentID"); radGridView1.MasterTemplate.Columns.Add(parentIdColumn); GridViewTextBoxColumn nameColumn = new GridViewTextBoxColumn("Name"); radGridView1.MasterTemplate.Columns.Add(nameColumn); GridViewTextBoxColumn addressColumn = new GridViewTextBoxColumn("Address"); radGridView1.MasterTemplate.Columns.Add(addressColumn); GridViewTextBoxColumn typeColumn = new GridViewTextBoxColumn("Type"); radGridView1.MasterTemplate.Columns.Add(typeColumn); radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; this.radGridView1.Relations.AddSelfReference(this.radGridView1.MasterTemplate, "ID", "ParentID"); AddNewRow("1", null, "Project", "USA", "Project"); AddNewRow("2", "1", "Site 1", "New York", "Site"); AddNewRow("3", "2", "Bldg 1", "Road 1", "Building"); AddNewRow("4", "1", "Site 2", "New York", "Site"); AddNewRow("5", "4", "Bldg 2", "Road 2", "Building"); AddNewRow("20", "3", "Floor 1", "Road 20", "Floor"); AddNewRow("30", "3", "Floor 2", "Road 30", "Floor"); AddNewRow("40", "3", "Floor 3", "Road 40", "Floor"); } public void AddNewRow( params object[] values) { if (values.Length != radGridView1.Columns.Count) return; GridViewRowInfo newRow = radGridView1.Rows.AddNew(); newRow.Cells[0].Value = values[0]; newRow.Cells[1].Value = values[1]; newRow.Cells[2].Value = values[2]; newRow.Cells[3].Value = values[3]; newRow.Cells[4].Value = values[4]; } When you run the project you will notice that the last row is missing (AddNewRow("40", "3", "Floor 3", "Road 40", "Floor");). Please refer to the attached screenshots. Workaround: use the Rows.Add(params) method instead:
How to Reproduce: Source XML: <?xml version="1.0" encoding="utf-8"?> <grandparent Date="2014-12-17Z" Name="Grandparent" SchemaVersion="1.0" Time="04:27:07Z" xmlns=""> <parent Name="parent1" City="Los Angeles"> <child Name="Child1" Age="5"/> <child Name="Child2" Age="8"/> </parent> <parent Name="parent2" City="Chicago"> <child Name="Child1" Age="11"/> <child Name="Child2" Age="15"/> </parent> </grandparent> public partial class Form1 : Form { public Form1() { InitializeComponent(); DataSet xmlDataSet = new DataSet(); xmlDataSet.ReadXml(@"..\..\test.xml"); GridViewTemplate parentTemplate = new GridViewTemplate(); this.radGridView1.MasterTemplate.Templates.Add(parentTemplate); GridViewRelation relation = new GridViewRelation(this.radGridView1.MasterTemplate); relation.ChildTemplate = parentTemplate; relation.RelationName = "Grandparent_Parent"; relation.ParentColumnNames.Add("grandparent_Id"); relation.ChildColumnNames.Add("grandparent_Id"); radGridView1.Relations.Add(relation); this.radGridView1.DataSource = xmlDataSet.Tables[0]; parentTemplate.DataSource = xmlDataSet.Tables[1]; parentTemplate.AllowAddNewRow = false; GridViewTemplate childTemplate = new GridViewTemplate(); parentTemplate.Templates.Add(childTemplate); GridViewRelation childRelation = new GridViewRelation(parentTemplate); childRelation.ChildTemplate = childTemplate; childRelation.RelationName = "Parent_Child"; childRelation.ParentColumnNames.Add("parent_Id"); childRelation.ChildColumnNames.Add("parent_Id"); radGridView1.Relations.Add(childRelation); childTemplate.DataSource = xmlDataSet.Tables[2]; } } Workaround - set the data sources of the templates last, or use auto generate hierarchy: this.radGridView1.AutoGenerateHierarchy = true; DataSet xmlDataSet = new DataSet(); xmlDataSet.ReadXml(@"..\..\test.xml"); this.radGridView1.DataSource = xmlDataSet; radGridView1.DataMember = "grandparent"; this.radGridView1.AutoGenerateHierarchy = true;
Use the following code snippet and follow the illustrated steps on the attached gif file: private void Form1_Load(object sender, EventArgs e) { this.customersTableAdapter.Fill(this.nwindDataSet.Customers); this.radGridView1.DataSource = this.customersBindingSource; this.radGridView1.BestFitColumns(BestFitColumnMode.AllCells); 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; }
To reproduce: private void Form1_Load(object sender, EventArgs e) { this.customersTableAdapter.Fill(this.nwindDataSet.Customers); this.radGridView1.DataSource = this.customersBindingSource; this.radGridView1.BestFitColumns(Telerik.WinControls.UI.BestFitColumnMode.AllCells); this.radGridView1.AllowSearchRow = true; } Workaround: private void Form1_Load(object sender, EventArgs e) { RadDragDropService svc = this.radGridView1.GridViewElement.GetService<RadDragDropService>(); svc.PreviewDragDrop += svc_PreviewDragDrop; } private void svc_PreviewDragDrop(object sender, RadDropEventArgs e) { GridViewSearchRowInfo.Cancel = true; }
When the UserDeletingRow and UserDeletedRow are fired in multi cell selection mode, the event arguments should contains the rows of the selected cells.
1. Create a new project with RadGridView. 2. Bind it. 3. Add some filter descriptors. 4. Handle the CustomFiltering event and add custom filter for some column. 5. Run the project and you will see that all other filters are not applied.
When you use a custom GroupComparer for the MasterTemplate, grouping is performed successfully for the first time. However, if you remove all groups and perform grouping again for the same columns, the grid behavior is not as expected: you will notice groups mismatching or duplication. Here is a sample code snippet which incorrect behavior is illustrated on the attached gif file: public Form1() { InitializeComponent(); DataTable dt = new DataTable(); dt.Columns.Add("Reference"); dt.Columns.Add("Test Case"); dt.Columns.Add("ChBW"); dt.Columns.Add("Voltage"); dt.Columns.Add("Environmental Conditions"); dt.Columns.Add("RadioAccessTechnology"); dt.Rows.Add("4.2.1", "E-Utran FDD...", "10", "C Nominal-2", "T Nominal - V Nominal", "E-UTRAN Only"); dt.Rows.Add("5.2.1", "E-Utran FDD...", "3", "C Nominal-1", "T Nominal - V Nominal", "E-UTRAN Only"); dt.Rows.Add("14.2.1", "E-Utran FDD...", "1", "C Nominal-3", "T Nominal - V Nominal", "E-UTRAN Only"); dt.Rows.Add("2.2.1", "E-Utran FDD...", "4", "C Nominal-2", "T Nominal - V Nominal", "E-UTRAN Only"); dt.Rows.Add("7.2.1", "E-Utran FDD...", "12", "C Nominal-1", "T Nominal - V Nominal", "E-UTRAN Only"); dt.Rows.Add("2.2.1", "E-Utran FDD...", "2", "C Nominal-3", "T Nominal - V Nominal", "E-UTRAN Only"); this.radGridControlSelection.DataSource = dt; this.radGridControlSelection.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; this.radGridControlSelection.MasterTemplate.GroupComparer = new GroupComparer(); } public class GroupComparer : IComparer<Group<GridViewRowInfo>> { public int Compare(Group<GridViewRowInfo> x, Group<GridViewRowInfo> y) { if (x.Level != y.Level) { } DataGroup group = x as DataGroup; var a = x.Header; var b = y.Header; int valueA; int valueB; if (group == null) { group = y as DataGroup; } if (group != null && group.GroupDescriptor != null && group.GroupDescriptor.GroupNames.Count > 0) { string propertyName = group.GroupDescriptor.GroupNames.First().PropertyName; if ((propertyName.ToUpper() == "VOLTAGE")) { int indexA = GetIndexContain(a.ToString().Split(new char[] { '-' })[1]); int indexB = GetIndexContain(b.ToString().Split(new char[] { '-' })[1]); if (indexA == indexB) { return 0; } else if (indexA < indexB) { return -1; } else { return 1; } } else if (propertyName.ToUpper() == "RADIOACCESSTECHNOLOGY") { return x.Key.ToString().CompareTo(y.Key.ToString()); } // BAND else if (propertyName.ToUpper() == "CHBW") { Int32.TryParse(a, out valueA); Int32.TryParse(b, out valueB); //ASCENDING SELECTED if (group.GroupDescriptor.GroupNames.First().Direction == ListSortDirection.Ascending) { if (valueA > valueB) { return 1; } else if (valueA < valueB) { return -1; } else { return 0; } } //DESCENDING else { if (valueA > valueB) { return -1; } else if (valueA < valueB) { return 1; } else { return 0; } } } } return x.Key.ToString().CompareTo(y.Key.ToString()); } private int GetIndexContain(string a) { int parsedValue; if (int.TryParse(a, out parsedValue)) { return 10 - parsedValue; } return -1; } } Workaround: public class Grid:RadGridView { public override string ThemeClassName { get { return typeof(RadGridView).FullName; } } protected override RadGridViewElement CreateGridViewElement() { return new CustomGridViewElement(); } } public class CustomGridViewElement : RadGridViewElement { protected override Type ThemeEffectiveType { get { return typeof(RadGridViewElement); } } protected override MasterGridViewTemplate CreateTemplate() { return new CustomMasterGridViewTemplate(); } } public class CustomMasterGridViewTemplate : MasterGridViewTemplate { protected override GridViewListSource CreateListSource() { return new CustomGridViewListSource(this); } } public class CustomGridViewListSource : GridViewListSource { public CustomGridViewListSource(GridViewTemplate template) : base(template) { } protected override RadCollectionView<GridViewRowInfo> CreateDefaultCollectionView() { return new CustomGridDataView(this); } } public class CustomGridDataView : GridDataView { public CustomGridDataView(GridViewListSource listSource) : base(listSource) { } protected override GroupBuilder<GridViewRowInfo> CreateGroupBuilder() { return new CustomGroupBuilder(this.Indexer); } } public class CustomGroupBuilder : GridGroupBuilder { public CustomGroupBuilder(Index<GridViewRowInfo> index) : base(index) { } protected override Group<GridViewRowInfo> GetGroup(GroupCollection<GridViewRowInfo> cache, Group<GridViewRowInfo> newGroup, Group<GridViewRowInfo> parent, object key, int level) { GroupDescriptor currentDescriptor = this.CollectionView.GroupDescriptors[level]; DataGroup group = (DataGroup)base.GetGroup(null, newGroup, parent, key, level); if (group.GroupDescriptor != null && group.GroupDescriptor != currentDescriptor) { SetGroupDescriptor(group, null); IGroupFactory<GridViewRowInfo> groupFactory = this.CollectionView.GroupFactory; group = (DataGroup)groupFactory.CreateGroup(key, parent); group.GroupBuilder = this; } SetGroupDescriptor(group, currentDescriptor); return group; } private void SetGroupDescriptor(DataGroup dataGroup, GroupDescriptor currentDescriptor) { FieldInfo fi = typeof(DataGroup).GetField("groupDescriptor", BindingFlags.NonPublic | BindingFlags.Instance); fi.SetValue(dataGroup, currentDescriptor); } }
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: void radGridView1_CurrentRowChanged(object sender, Telerik.WinControls.UI.CurrentRowChangedEventArgs e) { e.CurrentRow.Cells[2].ColumnInfo.IsCurrent = true; }
Excel like filtering does not select dates in the Calendar, when During last 7 day or Yesterday are checked.
Workaround - listen for Reset of the rows collection and introduce your modification there: radGridView1.Rows.CollectionChanged += Rows_CollectionChanged; void Rows_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e) { if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Reset) { foreach (GridViewRowInfo row in radGridView1.Rows) { row.Cells[0].Value = false; } } }
To reproduce: private void Form1_Load(object sender, EventArgs e) { GridSearchRowElement searchRow = null; foreach (GridRowElement row in this.radGridView1.TableElement.VisualRows) { if (row is GridSearchRowElement) { searchRow = row as GridSearchRowElement; break; } } if (searchRow != null) { searchRow.SearchCellElement.SearchBoxWidth = 400; } } Workaround: radGridView1.TableElement.InvalidateMeasure(true); radGridView1.TableElement.UpdateLayout();
Steps to reproduce: 1. Drag a RadGridView to a form 2. Add a text column and a hyperlink column 3. Add a row with null value for the hyperlink cell 4. Set some text for the hyperlink cell 5. Subscribe to the HyperlinkOpening/ed events 6. Run the project and click on the hyperlink, you will see that none of the events will be fired. Workaround: To work around it, you can create your own cell element which derives from the GridHyperlinkCellElement and override the ProcessHyperlink method to handle the user clicking on a hyperlink: public class MyHyperlinkCellElement : GridHyperlinkCellElement { public MyHyperlinkCellElement(GridViewColumn col, GridRowElement row) : base(col, row) { } protected override void ProcessHyperlink() { //handle hyperlink click } } After you have created your cell element, you can replace the original using the CreateCell event of the RadGridView: private void radGridView1_CreateCell(object sender, GridViewCreateCellEventArgs e) { if (e.Column is GridViewHyperlinkColumn) { e.CellType = typeof(MyHyperlinkCellElement); } }
To reproduce: use the following code snippet and follow the steps illustrated on the attached gif file: private void Form1_Load(object sender, EventArgs e) { this.customersTableAdapter.Fill(this.nwindDataSet.Customers); this.radGridView1.DataSource = this.customersBindingSource; this.radGridView1.BestFitColumns(BestFitColumnMode.AllCells); 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; } Sometimes the incorrect behavior is obtained immediately after you drop the column, but you need to scroll the horizontal scroll-bar to replicate it. Workaround: RadGridViewDragDropService svc = this.radGridView1.GridViewElement.GetService<RadGridViewDragDropService>(); svc.Stopped += svc_Stopped; private void svc_Stopped(object sender, EventArgs e) { int horizontalScrollvalue = this.radGridView1.TableElement.HScrollBar.Value; this.radGridView1.MasterTemplate.Refresh(); this.radGridView1.TableElement.HScrollBar.Value = horizontalScrollvalue; }
To reproduce: following the illustrated steps: http://screencast.com/t/D2TCpU2zo Workaround: set up the hierarchy programmatically.
When a Right-To-Left grid is printed the text of all print cells should be drawn with the StringFormatFlags.DirectionRightToLeft. Example: RadGridView with RightToLeft set to Yes A decimal column with negative values the values in the decimal column are drawn as 96-, 88- etc if this grid is printed the values will be -96, -88 Workaround: http://www.telerik.com/community/forums/radprintdocument-from-a-grid-wrong-format-when-right-to-left-true-in-grid
Allow setting the height of the group panel in design time: - by setting its height property - by using mouse cursor via property builder