Is there a way to remove the spinner control from columns defined as GridViewDecimalColumn? I'm just looking for a simple cell entry like in Excel with no spinner. The GridViewDecimalColumn type is being used because the input must be numeric only. Thank you
I had to modify the code slightly because I am still stuck on the Q2 2010 release thanks to a gridview problem with a large number of columns (see this thread http://www.telerik.com/community/forums/wpf/gridview/speed-slowdown-using-sp2010-3-10-1215.aspx, I have turned in a support ticket and am waiting feedback from telerik).
void radGridView_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
var gridViewEditor = sender as GridViewEditManager;
if (gridViewEditor != null)
{
var editor = gridViewEditor.ActiveEditor as GridSpinEditor;
if (editor != null && e.ColumnIndex >= 4)
{
var editorElement = editor.EditorElement as GridSpinEditorElement;
editorElement.TextBoxItem.KeyDown -= new KeyEventHandler(TextBoxItem_KeyDown);
editorElement.TextBoxItem.KeyDown += new KeyEventHandler(TextBoxItem_KeyDown);
editorElement.Value = e.Value == null ? 0 : decimal.Parse(e.Value.ToString());
editorElement.TextAlignment = HorizontalAlignment.Right;
editor.Step = 0;
editorElement.ShowUpDownButtons = false;
}
}
}
I added an additional line to handle the horizontal alignment of the text field; numbers in our software are always right aligned. The thread referred did help. Thank you.