Save the value entered in the DevExpress Xtragrid cell

I am using the DevExpress Xtragrid control in my Windows C # .net application.

I enter some value in the first cell of the grid, and if I go to the second cell, the value entered in the first cell disappears.

How to save the value entered in the cell?

+3
source share
2 answers

I assume that you are using this for an unrelated column in a gridView (Xtragrid), the first step is to go to the column properties and change the property value UnboundTypeto the data type that you will enter in this column, the example below uses double.

CustomUnboundColumnData gridView. , ( _userEnteredData ), , gridView, , , gridView :

:

private double _userEnteredData = 0;

:

private void gridView1_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e)
{
    if (e.Column == gridColumn_YourColumn && e.IsSetData)
    {
        _userEnteredData = Convert.ToDouble(e.Value);
    }
    else if (e.Column == gridColumn_YourColumn && e.IsGetData)
    {
        e.Value = _userEnteredData;
    }
}

, .

: http://documentation.devexpress.com/#WindowsForms/CustomDocument1477

+1

:

  • FieldName . , , .
  • , . ,
  • ColumnOptions.ReadOnly grid - false

,

+1

Source: https://habr.com/ru/post/1729523/


All Articles