Data Binding Format DataGridView Int Int Month Name Conversion

I have a dataagridview. In it, I have a column with NULL values ​​and 1-12. How can I make a datagridview at runtime turn on 1 in January and display it in a cell? And NULL to another predefined string?

I tried to look at the format of the cell, change it to a custom one, then put it in "MMM", but it did not work and displayed "MMM" in the actual cell.

Please, help.

EDIT: its winforms C # 4.0, the field is bound to the Int field from the object in EF. And there is no need for culture, and English is fine.

EDIT: I tried {0: MMM}, it did not work, it just displayed {X: MMM} in the cell where X is int.

Some screenshots:

format

result

+5
source
2

: , DisplayMonth, , . , EF? , , , EF.

:

public string DisplayMonth
{
  get { return ConvertToString(this.Date); //TODO: create ConvertToString method }
  set { return this.Date = ConvertFromString() //TODO: create ConvertFromString method ; }
}

, CellFormatting, , .

+1

All Articles