Completed
Last Updated: 23 Jul 2015 13:03 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 01 Jul 2015 16:00
Category: GridView
Type: Bug Report
1
FIX. RadGridView - when the GridViewDecimalColumn.Minimum is changed, the spin editor in the filter cell is initialized with the minimum value
Note: if you try to clear the initial minimum value by pressing Backspace or Delete key, the editor value reappears.

To reproduce:

GridViewDecimalColumn decimalColumn2 = new GridViewDecimalColumn("Col2");
decimalColumn2.FieldName = "Number";
decimalColumn2.Minimum = -50;
decimalColumn2.Maximum = 50;

radGridView2.MasterTemplate.Columns.Add(decimalColumn2);
radGridView2.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
radGridView2.EnableFiltering = true;


Workaround:

private void radGridView2_EditorRequired(object sender, Telerik.WinControls.UI.EditorRequiredEventArgs e)
{
    if (e.EditorType == typeof(GridSpinEditor))
    {
        e.EditorType = typeof(CustomEditor);
    }
}

public class CustomEditor : GridSpinEditor
{
    protected override Telerik.WinControls.RadElement CreateEditorElement()
    {
        return new CustomElement();
    }
}

public class CustomElement : GridSpinEditorElement
{
    protected override decimal GetValueFromText()
    {
        if (string.IsNullOrEmpty(this.Text))
        {
            return this.MinValue;
        }
        return base.GetValueFromText();
    }
}
Attached Files:
0 comments