Use attached to reproduce.
Workaround:
this.LoadFieldList(hiddenGrid.MasterTemplate);
this.FieldList.Add(new Telerik.Data.Expressions.ExpressionItem()
{ Name = "Test", Description = "Test", Syntax = "Test", Type = Telerik.Data.Expressions.ExpressionItemType.Field, Value = "Test" });
Use attached to reproduce. Workaround: DragDropService.AllowAutoScrollColumnsWhileDragging = false; DragDropService.AllowAutoScrollRowsWhileDragging = false;
Use attached to reproduce. Workaround: Use CellFormatting instead of RowFormating.
To reproduce, perform the following steps with the attached project:
Step 1: Create Sample Database
==============================
New (Sample1.db)
Import
Save
Close
Step 2:
======
Open (Sample1.db)
Import
Save
Close
Step 3:
======
New (Sample2.db)
Import (Exception)
Workaround:
radGridView1.GridViewElement.Navigator = new MyNavigator();
class MyNavigator : BaseGridNavigator
{
public override bool SelectLastRow()
{
var enumerator = typeof(BaseGridNavigator).GetField("enumerator", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this) as GridTraverser;
enumerator.Reset();
return base.SelectLastRow();
}
}
To reproduce:
private void radButton1_Click(object sender, EventArgs e)
{
radGridView1.MasterView.TableSearchRow.SelectNextSearchResult();
}
Check the index in the search textbox, it is not updated.
Workaround:
var cell = radGridView1.TableElement.FindDescendant<GridSearchCellElement>();
if (cell != null)
{
cell.FindNextButton.PerformClick();
}
Use attached to reproduce. With versions prior 2015.3.930 the results are different.
To reproduce:
private void RadGridView1_UserAddingRow(object sender, Telerik.WinControls.UI.GridViewRowCancelEventArgs e)
{
radGridView1.MasterView.TableAddNewRow.CancelAddNewRow();
}
See attached video.
Workaround:
private void RadGridView1_UserAddingRow(object sender, Telerik.WinControls.UI.GridViewRowCancelEventArgs e)
{
radGridView1.MasterView.TableAddNewRow.CancelAddNewRow();
radGridView1.MasterView.ViewTemplate.DataView.CurrentItem.IsCurrent = false;
}
To reproduce:
Use the following code
private void RadGridView1_UserAddingRow(object sender, GridViewRowCancelEventArgs e)
{
radGridView1.MasterView.TableAddNewRow.CancelAddNewRow();
radGridView1.MasterView.ViewTemplate.DataView.CurrentItem.IsCurrent = false;
}
Place the new row at the bottom. While in edit mode press tab to fill until an exception is thrown.
Workaround:
BaseGridBehavior gridBehavior = radGridView1.GridBehavior as BaseGridBehavior;
gridBehavior.UnregisterBehavior(typeof(GridViewNewRowInfo));
gridBehavior.RegisterBehavior(typeof(GridViewNewRowInfo), new CustomGridRowBehavior());
internal class CustomGridRowBehavior : GridNewRowBehavior
{
protected override bool ProcessTabKey(KeyEventArgs keys)
{
bool newRowIsInEditMode = this.IsInEditMode && this.GridViewElement.CurrentRow is GridViewNewRowInfo;
if ( newRowIsInEditMode && this.GridViewElement.Navigator.IsLastEditableColumn(this.GridViewElement.CurrentColumn))
{
this.GridViewElement.Navigator.SelectFirstColumn();
while (this.GridViewElement.CurrentColumn.ReadOnly && this.GridViewElement.Navigator.SelectNextColumn())
{ }
return false;
}
return base.ProcessTabKey(keys);
}
}
To reproduce: please refer to the attached sample project and gif file. Workaround: add the column programmatically, not at design time.
how can i insert , update or delete? i tried after choosing the data source , it shows the data correctly but when i edit or add a new item the database is not affected (allow edit,delete and add row are set to true)
Use attached to reproduce.
Workaround:
class MySpreadExportRenderer : SpreadExportRenderer
{
public override void SetWorksheetColumnWidth(int columnIndex, double value, bool isCustom)
{
if (value > 2000)
{
value = 2000;
}
base.SetWorksheetColumnWidth(columnIndex, value, isCustom);
}
}
To reproduce:
if (e.CellElement.ColumnInfo.HeaderText == "CategoryID")
{
e.CellElement.DrawText = false;
}
else
{
e.CellElement.ResetValue(LightVisualElement.DrawTextProperty, ValueResetFlags.Local);
}
Workaround:
e.CellElement.DrawText = true;
Use attached to reproduce! Workaround: remove the Begin\End update block.
Use attached to reproduce. Workaround: Set the TableHeaderHeight again after loading the layout.
To reproduce:
GridViewCheckBoxColumn chkCol = new GridViewCheckBoxColumn();
chkCol.HeaderText = "I have wrap text set yet I cannot see full column header text.";
chkCol.Width = 90;
chkCol.WrapText = true;
chkCol.EnableHeaderCheckBox = true;
chkCol.EditMode = EditMode.OnValueChange;
radGridView1.Columns.Add(chkCol);
Workaround:
private void RadGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
var cell = e.CellElement as GridCheckBoxHeaderCellElement;
if (cell != null)
{
cell.CheckBox.TextWrap = true;
}
}
How to reproduce: bind the grid using the code snippet below and enter name in the SearchRow
public partial class RadForm1 : Telerik.WinControls.UI.RadForm
{
public RadForm1()
{
InitializeComponent();
this.radGridView1.DataSource = this.GetData();
this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
this.radGridView1.AllowSearchRow = true;
this.radGridView1.MasterView.TableSearchRow.InitialSearchResultsTreshold = 0;
this.radGridView1.MasterView.TableSearchRow.SearchResultsGroupSize = int.MaxValue;;
}
private DataTable GetData()
{
DataTable dt = new DataTable();
dt.Columns.Add("Id", typeof(int));
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Date", typeof(DateTime));
dt.Columns.Add("Bool", typeof(bool));
dt.Columns.Add("Description", typeof(string));
for (int i = 0; i < 2000; i++)
{
for (int j = 0; j < 5; j++)
{
dt.Rows.Add(i, "Name " + j, DateTime.Now.AddDays(i), i % 2 == 0 , "Description " + i);
}
}
return dt;
}
}
Workaround: in the search row, set the InitialSearchResultsTreshold property to 0 and the SearchResultsGroupSize property to int.MaxValue
public RadForm1()
{
InitializeComponent();
this.radGridView1.DataSource = this.GetData();
this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
this.radGridView1.AllowSearchRow = true;
this.radGridView1.MasterView.TableSearchRow.SearchProgressChanged += TableSearchRow_SearchProgressChanged;
this.radGridView1.MasterView.TableSearchRow.InitialSearchResultsTreshold = 0;
this.radGridView1.MasterView.TableSearchRow.SearchResultsGroupSize = int.MaxValue;
}
Use attached to reproduce.
- Edit random cell and press Enter.
- Check the CellValueChanged event handler, the changes variable is null.
This will work if you comment the OnShown method.
Workaround:
IEditableObject editbaleObject = radGridView1.CurrentRow.DataBoundItem as IEditableObject;
if (editbaleObject != null)
{
editbaleObject.EndEdit();
}
After populating the RadGridView, unbound in this example, I use RadGridView1.ClearSelection. This works when using some themes such as Crystal and Office2013, but not others, like Fluent. See attached..... believe me that the code is EXACTLY the same for each, just the application theme is difference. This should be an easy one to replicate.
Use attached to reproduce.
- Check then try to uncheck the rows.
Workaround:
private void RadGridView1_CreateCell(object sender, GridViewCreateCellEventArgs e)
{
if (e.CellType == typeof(GridCheckBoxHeaderCellElement))
{
e.CellElement = new MyHeaderCheckboxCellElement(e.Column, e.Row);
}
}
class MyHeaderCheckboxCellElement : GridCheckBoxHeaderCellElement
{
public MyHeaderCheckboxCellElement(GridViewColumn col, GridRowElement row) : base (col, row)
{ }
protected override void checkbox_ToggleStateChanged(object sender, StateChangedEventArgs args)
{
base.checkbox_ToggleStateChanged(sender, args);
var prop = this.ViewInfo.GetType().GetProperty("Version", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
int value = (int)prop.GetValue(this.ViewInfo);
prop.SetValue(this.ViewInfo, --value);
}
}