To reproduce:
radGridView1 = new RadGridView();
radGridView1.Dock = DockStyle.Fill;
Controls.Add(radGridView1);
t.Columns.Add("ID");
t.Rows.Add(7);
t.Rows.Add(5);
t.Rows.Add(8);
t.Rows.Add(4);
t.Rows.Add(9);
radGridView1.DataSource = t;
radGridView1.Columns[0].Width = 100;
With the code above, start the app, sort the grid ascending and select the row with value 8. Use the following code on a button to delete the row with value 5:
private void radButton1_Click(object sender, EventArgs e)
{
t.Rows[1].Delete();
}
In this case, the current should be the row with value 8, not the one with value 7 as is.
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)
{
}
To reproduce:
public Form1()
{
InitializeComponent();
InitializeRadGridView();
this.Size = new System.Drawing.Size(782, 647);
radGridView1.DataSource = GetDataSource();
radGridView1.MasterTemplate.ExpandAll();
}
private void InitializeRadGridView()
{
radGridView1.EnableGrouping = false;
radGridView1.AllowAddNewRow = false;
radGridView1.MasterTemplate.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
GridViewDataColumn column = new GridViewTextBoxColumn();
column.FieldName = "Name";
radGridView1.MasterTemplate.Columns.Add(column);
GridViewTemplate template = new GridViewTemplate();
template.AllowCellContextMenu = false;
template.AllowColumnHeaderContextMenu = false;
template.AutoGenerateColumns = false;
template.ShowRowHeaderColumn = false;
template.ShowColumnHeaders = false;
template.AllowAddNewRow = false;
template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
radGridView1.Templates.Add(template);
GridViewRelation relation = new GridViewRelation(radGridView1.MasterTemplate, template);
relation.ChildColumnNames.Add("Bs");
radGridView1.Relations.Add(relation);
column = new GridViewTextBoxColumn();
column.FieldName = "Name";
radGridView1.Templates[0].Columns.Add(column);
column = new GridViewImageColumn();
column.MinWidth = column.MaxWidth = 30;
radGridView1.Templates[0].Columns.Add(column);
radGridView1.Templates[0].AllowRowReorder = true;
template = new GridViewTemplate();
template.AllowCellContextMenu = false;
template.AllowColumnHeaderContextMenu = false;
template.AutoGenerateColumns = false;
template.ShowRowHeaderColumn = false;
template.ShowColumnHeaders = false;
template.AllowAddNewRow = false;
template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
radGridView1.Templates[0].Templates.Add(template);
relation = new GridViewRelation(radGridView1.Templates[0], template);
relation.ChildColumnNames.Add("Cs");
radGridView1.Relations.Add(relation);
column = new GridViewTextBoxColumn();
column.FieldName = "Name";
radGridView1.Templates[0].Templates[0].Columns.Add(column);
radGridView1.Templates[0].Templates[0].AllowRowReorder = true;
}
private List<A> GetDataSource()
{
List<A> list = new List<A>();
A a1 = new A();
a1.Id = 1;
a1.Name = "A1";
list.Add(a1);
A a2 = new A();
a2.Id = 2;
a2.Name = "A2";
list.Add(a2);
A a3 = new A();
a3.Id = 3;
a3.Name = "A3";
list.Add(a3);
B b1 = new B();
b1.Id = 10;
b1.Name = "B1";
a1.Bs.Add(b1);
B b2 = new B();
b2.Id = 20;
b2.Name = "B2";
a1.Bs.Add(b2);
B b3 = new B();
b3.Id = 30;
b3.Name = "B3";
a1.Bs.Add(b3);
B b4 = new B();
b4.Id = 40; b4.Name = "B4";
a2.Bs.Add(b4);
B b5 = new B();
b5.Id = 50; b5.Name = "B5";
a3.Bs.Add(b5);
C c1 = new C();
c1.Id = 100;
c1.Name = "C1";
b1.Cs.Add(c1);
b3.Cs.Add(c1);
C c2 = new C();
c2.Id = 200;
c2.Name = "C2";
b1.Cs.Add(c2);
b2.Cs.Add(c2);
b2.Cs.Add(c1);
C c3 = new C();
c3.Id = 300;
c3.Name = "C3";
b1.Cs.Add(c3);
b2.Cs.Add(c3);
b3.Cs.Add(c3);
C c4 = new C();
c4.Id = 400;
c4.Name = "C4";
b4.Cs.Add(c4);
C c5 = new C();
c5.Id = 500;
c5.Name = "C5";
b5.Cs.Add(c5);
return list;
}
}
public class A
{
public int Id { get; set; }
public string Name { get; set; }
public List<B> Bs { get; set; }
public A() { Bs = new List<B>();
}
}
public class B
{
public int Id { get; set; }
public string Name { get; set; }
public List<C> Cs { get; set; }
public B() { Cs = new List<C>();
}
}
public class C
{
public int Id { get; set; }
public string Name { get; set;
}
}
The last row is not fully visible, hence a scroll bar should be shown
Workaround: collapse and expand the last row in the grid:
radGridView1.MasterTemplate.ExpandAll();
radGridView1.ChildRows[radGridView1.ChildRows.Count - 1].IsExpanded = false;
radGridView1.ChildRows[radGridView1.ChildRows.Count - 1].IsExpanded = true;
To reproduce:
Dim RadGridView1 As New RadGridView
Me.Controls.Add(RadGridView1)
RadGridView1.Dock = DockStyle.Fill
Dim r As New Random()
Dim table As New DataTable()
table.Columns.Add("ID", GetType(Integer))
ConditionalFormattingObjects should be cleared or they should be applied after rebinding completes. WORKAROUND: save the ConditionalFormattingObjects, reset the data source and then restore them in order to overcome the observed error:
FIX. RadGridView - exception when binding to entities collection and specifying DataMember under Windows XP
Workaround: this.radGridView1.XmlSerializationInfo.SerializationMetadata.Add(typeof(GridViewSummaryItem),
"AggregateExpression", DesignerSerializationVisibilityAttribute.Content);
To reproduce:
void radGridView1_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
GridFilterCellElement filterCell = e.CellElement as GridFilterCellElement;
if (filterCell != null)
To reproduce use the code above and when the application starts double click the column in order to best fit it : RadGridView radGridView1 = new RadGridView();
this.Controls.Add(radGridView1);
radGridView1.Columns.Add("some text");
radGridView1.HideSelection = true;
IMPROVE. RadGridView - expose the color dialog form in GridColorPickerElement
For example when you set 11, the year should change to 2011. Currently it concatenates the new digits to the previous year and then it removes the first two digits.
Add a filter condition using the filter row of the RadGridView which filters all but one item and it will not be selected automatically.
1. Drag a RadGridView on a form. 2. Set the EnableFiltering and ShowHeaderCellButtons to true. 3. Fill the grid with data and run the project. 4. Open the filter popup and type something in the text field. 5. Press enter key and the popup will be closed without applying the filter.
Steps to reproduce. 1. Add a RadGridView to a form 2. Add a decimal column and set its DataType to any unsigned integer type (uint16, uint32, uint64) 3. Add some values and export the grid with ExportToExcelML 4. You will see that in the exported grid the cells in the column would have "0" as a value.
To reproduce: 1. Add RadGridView with 2 columns 2. Sort first column. Then sort second column. 3. Break in the SortChanged event handler method 4. e.NewItems[0].PropertyName is 'column1' and e.OldItems[0].PropertyName is 'column2', the values are swapped
To reproduce:
-add a RadGridView and use the following code:
public Form1()
{
InitializeComponent();
GridViewComboBoxColumn comboColumn = new GridViewComboBoxColumn("ComboBox column");
comboColumn.DataSource = new List<string>() { "first", "second", "third" };
radGridView1.Columns.Add(comboColumn);
radGridView1.CellEditorInitialized += radGridView1_CellEditorInitialized;
}
private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
RadDropDownListEditor dropDownEditor = radGridView1.ActiveEditor as RadDropDownListEditor;
RadDropDownListEditorElement dropDownEditorElement = dropDownEditor.EditorElement as RadDropDownListEditorElement;
dropDownEditorElement.SelectedIndex = 0;
}
If you try to add a new row in the grid, the first item in the RadDropDownListEditor is selected. If you do not make any selection changes and press Enter key, the new row will not be added.
Workaround: use the DefaultValuesNeeded event for initializing RadDropDownListEditorElement's selectin
To reproduce:
-add hierarchical RadGriddView with one parent template and several child templates;
-set TableElement.PageViewMode to PageViewMode.ExplorerBar;
Selection for different templates is not performed correcltly.
Workaround: use custom GridDataRowBehavior:
BaseGridBehavior gridBehavior = this.radGridView1.GridBehavior as BaseGridBehavior;
gridBehavior.UnregisterBehavior(typeof(GridViewDataRowInfo));
gridBehavior.RegisterBehavior(typeof(GridViewDataRowInfo),
new RowSelectionGridBehavior());
public class RowSelectionGridBehavior : GridDataRowBehavior
{
protected override bool OnMouseDownLeft(MouseEventArgs e)
{
GridDataRowElement row = this.GetRowAtPoint(e.Location) as GridDataRowElement;
if (row != null)
{
row.RowInfo.IsSelected = true;
row.RowInfo.IsCurrent = true;
return true;
}
return base.OnMouseDownLeft(e);
}
}
To reproduce:
Add a RadGridView to a form, dont dock it. Use the following code to add the rows, columns and the definition:
this.Grid.Columns.Add("Old");
this.Grid.Columns.Add("New");
Start the application and you will see that you cannot scroll to the end, horizontally.
Workaround:
Use the following code on a button click or execute it in a timer a few millisecond after the form has loaded in order to update the scrollbar's maximum value accordingly:
int width = 0;
foreach (var col in this.Grid.Columns)
{
width += col.Width;
}
this.Grid.TableElement.HScrollBar.Maximum = width - this.Grid.TableElement.HScrollBar.SmallChange - this.Grid.TableElement.RowHeaderColumnWidth;
To reproduce: - Add GridViewComboBoxColumn to a grid. - Set the DisplayMemeber property like this: column1.DisplayMember = "AddInfo.Status";
To reproduce:
Add a RadGridView. Create a DataTable with 3 columns with data type - Decimal. To the last column set the following expression - "column1 + column2". Add some rows with some values. Turn on excel like filtering - http://www.telerik.com/help/winforms/gridview-filtering-excel-like-filtering.html. Subscribe to the CellValueChanged event and add the following code:
if (this.radGridView1.CurrentRow.DataBoundItem != null)
{
((DataRowView)this.radGridView1.CurrentRow.DataBoundItem).Row.EndEdit(); // force row subtotal update
}
Start the application and filter the last column by some of the available values. Change a value in one of the first two cells. You will notice that the last cell's value is not updated although it is updated in the data table. This behavior does not occur when the grid is not filtered.