How to create DataGrid column parser?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In my .net application I use Windows.Forms.DataGrid bound to the datasource
to dispaly database contents. The bounding is done with GridColumnStyle and
its property MappingName which is associated with the name of a DataTable
column. Moreover the Format property of GridColumnStyle is set to "c2" to
dispaly numeric values as currency. It works fine however only in one
direction when the data is beeing displayed in the grid. The troubles start
when I want to input data via this grid. I can not just change the value in
the cell because it has currency suffix. It is necessary to remove the suffix
and then value passes validation and it is stored in the DataTable. When I am
working with a simple control (e.g. TextBox) I can modify its Binding and add
a parser. In case of DataGrid I can not get to the Binding. The
BindingContext property of the DataGrid is empty when columns are created.
Could you please suggest how to add a parser to DataGrid control column to
accept "c2" numeric values?
 
Back
Top