Groups | Blog | Home
all groups > dotnet windows forms databinding > november 2006 >

dotnet windows forms databinding : how parse/inject code to interpret datagrid column


jarb
11/14/2006 10:59:43 PM
..Net v1.1

Hello, Not sure what the best way to go about this is. I have a datagrid bound
to a datatable. One of the columns is a 2 char code. This is how it comes from
the database. In the datagrid, rather then show the code I would like to show a
description string that can come from a local lookup array. Where should I try
to do this mapping? Should I derive a custom DataGridColumnStyle for this? Or
should I try to do this lower down in the dataadapter? And I need it to work
both ways.. datagrid should display the description text and allow text entry,
but the database will send or recv the 2 char code. It should never get the
description text.

I have a similar situation for some Oracle bool fields that come as Y or N
chars. Should I derive my own DataGridBoolColumn?

Bart Mermuys
11/15/2006 1:05:29 PM
Hi,

[quoted text, click to view]

Probely the best way, yes. But you could derive from DataGridTextBoxColumn.
I guess the methods to override would be Commit and GetValueAtRow.
GetValueAtRow is used by the DataGridTextBoxColumn to paint the text for the
cells.

You could also use a DataGridComboBoxColumn which isn't included in the
framework but you should be able to find sourcecode for it, and even if you
don't want to use a ComboBoxColum, you might still learn from the code.

[quoted text, click to view]

Have you already tried DataGridBoolColumn.TrueValue and FalseValue, seems to
work.

HTH,
Greetings


[quoted text, click to view]

AddThis Social Bookmark Button