Completed
Last Updated: 21 Nov 2024 13:15 by ADMIN
Release 2024.4.1113 (2024 Q4)
Mark
Created on: 09 Aug 2024 11:47
Category: GridView
Type: Bug Report
0
RadGridView: The editor of GridViewCalculatorColumn resets the value of the call to 0
In this case, we have GridViewCalculatorColumn. The cell value is 123, for example. Trying to edit the cell value, the RadCalculatorEditor reset the cell value to 0. 
1 comment
ADMIN
Dinko | Tech Support Engineer
Posted on: 09 Aug 2024 11:52

Hi Mark,

Thank you for reporting this. As a workaround, we can store the value of the cell before the BegingEdit() code base, and set it again.

public partial class Form1 : Form
{
    DataTable table;
    public Form1()
    {
        InitializeComponent();
        table = new DataTable();
        table.Columns.Add("Name", typeof(string));
        table.Columns.Add("Value", typeof(double));
        table.Rows.Add("John", 123);
        table.Rows.Add("Adam", 456);
        table.Rows.Add("Peter", 789);
        this.radGridView1.DataSource = table;
        var calculatorColumn = new GridViewCalculatorColumn();
        calculatorColumn.HeaderText = "Calculator Column";
        calculatorColumn.FieldName = "Value";
        this.radGridView1.Columns.Add(calculatorColumn);
        this.radGridView1.EditorRequired += RadGridView1_EditorRequired;
    }

    private void RadGridView1_EditorRequired(object sender, EditorRequiredEventArgs e)
    {
        if (e.EditorType.Name == "RadCalculatorEditor")
        {
            e.Editor = new CustomCalculatorEditor();
        }
    }
}
public class CustomCalculatorEditor : RadCalculatorEditor
{
    public override void BeginEdit()
    {
        var val = this.Value;
        base.BeginEdit();
        this.Value = val;
    }
}

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.