There is no direct way to retrieve the text that is set for any cell in the TableControlDrawCellDisplayText event because the GridStyleInfo object associated with the cell does not hold any information.
The text can be retrieved by having a hashtable with record and the column names as the hashcode key. In the following code example, a unique key for each cell is generated because the row index might be changed due to other functions. For example, Sorting. The GetKey method is used to convert the record and column names to hashcode key.
A column QtyPerUnit is customized by the TableControlDrawCellDisplayText event to format the cell value to Kilograms. For example, 1000 is changed to 1 Kg. These customized texts are stored into the hashtable based on its hashcode key.
Finally, the value of the selected records is retrieved and the customized text is recovered through the hashtable ht[GetKey(record, "QtyPerUnit")]. These changes are handled in the buttonClick event.
After applying the properties, the Grid looks like the following screenshot.
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:|