I have two fields in my datasource lets call them
dataValue and displayText.
I Bind my grid to this dataset and get two columns, I hide the dataValue column and add A ValueList to thedisplayText.Column.ValueList property to create a drop down of selectable values for my display text column. Anything I select puts the displayText of my valueList in the displayText column/cell.
Is there a way for me to simply bind the selected Value to the dataValue column?
Actually I think I need the exact opposite. Although it should be the same solution. I'm storing the selected value in the column with the list. but i also want to bind another column to the selected display text.
Hi,
Typically, your grid would not contain both fields, it only needs one. There's no reason for the grid to store both the DataValue and the DisplayText if the text is simple a lookup on the value.
All you have to do is attach a ValueList to the DataValue column in the grid. And you populate the ValueList with the DataValue/DisplayText pairs and it will handle the translation for you.
lanierhall said:I'm guessing there's no simple way to bind then.
No, there is not.
I'm doing this in the AfterCellListClosed event. I'm guessing there's no simple way to bind then.
Thanks,
So you have the data stored in two different tables? Or it this a single table providing both the dropdown and the grid?
I'd probably still hide the DisplayText column in the grid and show only the DataValue. Then attach a ValueList to the DataValue column which translates the values into DisplayText for you. Then all you have to do is updated the DisplayText column in the row any time the DataValue field changes. You could do this in any number of events, like AfterCellUpdate. You just have to make sure you trap for the DataValue column and then use the EventManager to turn off the event while you set the value of the cell in the DisplayText column to prevent the event from firing recursively.
I understand, but unfortunately this is the database I was dealt and I have to implement it to be compatible with the old version.