views:

1294

answers:

1

Hi, I'm having trouble with an infragistics ultragrid using vb.net. I currently have a cell with the value "inner", however I want to be able to display a completely different string for that cell without losing the value. I understand that the cell has two properties, one value property and one text property. The text property is read-only so I cannot simply assign a new string to that. Any suggestions would be fantastic!

Thank you very much, Adem

+2  A: 

Depending on your implementation, you may need to use a ValueList in order to do this.

As stated on the documentation for the UltraGridCell.Text Property:

A cell's Text property can't contain something different from its Value property. Setting the Text overwrites whatever is already in the Value property. It is better to set the Value property directly so you can set a typed object.

If you need the text displayed to be different from the Value of the column you can add a UltraGridColumn.ValueList to the column that contains a list of text and value pairs. You can use a ValueList to do this even if you don't want to make the column editable.

There are other ways you can go about handling this, but it depends on your scenario. For example, if the text/value combination cannot be changed during runtime, it may better suit you to just add a hidden column to the grid that holds the "value" that corresponds to your displayed "text".

On the other hand, if your scenario requires the user be able to choose from a list of items and you want to grab the associated value of a selected item, a ValueList is the way to go. This post offers a simple example of how to bind an UltraGridColumn to a ValueList.

Steve Dignan