I am binding lists of objects to an UltraWinGrid on a windows form. Various columns are foreign keys, and so I am using a ValueList to show the description rather than the key of the foreign row.
Regardless of the data type of the key column, the description of the foreign row appears in the cell.
If the key column happens to be an integer, when a different description is selected, upon leaving focus from the cell, the underlying foreign key value is appropriately updated to the new integer value.
However, if the key column happens to be a guid, the cell reverts back to the original value and description upon leaving focus from the cell.
Is there something special I must do to get the guid-based foreign key value to save correctly?
It sounds like the column's DataType cannot handle GUIDs. Generally speaking, the behavior you describe is what happens when the column's data type is inconsistent with the type of the data being entered. If you are able to post a simple sample we can take a look and let you know what the problem is.
Thanks for taking a look, Brian. Your insight already gives me other ideas. Rather than try to carve out a run-able sample immediately, perhaps I should share a little more background, based on your 1st reply
I never really specify any data types for the columns - I let the UltraWinGrid.DataSource setter handle it.
I'm starting to wonder if this has been a bad practice, but for years I've not pre-configured the columns when binding DataTables to UltraWinGrids, instead opting to let the property setter for .DataSource take care of that for me. When I wish to hide, configure, create value lists, etc. for columns, I've done that in the InitializeLayout event.
The property common to the bound list's class and the value list's class is GUID in both cases...
Here's a snippet of the class that defines the bound list's objects...
public class UiConfigObject{public virtual Guid UiConfigObjectId { get; set; }public virtual string Description { get; set; }public virtual string Caption { get; set; }public virtual Guid UiConfigClassDefinitionId { get; set; }
Here's a snippet of the class that defines the value list's objects...
public class UiConfigClassDefinition {public Guid UiConfigClassDefinitionId { get; set; }public string Name { get; set; }
UiConfigClassDefinitionId is the column in question. In InitializeLayout, I set the ValueList...
IList<UiConfigClassDefinition> valList = _service.GetUiConfigClassDefinitions(); col.ValueList = epsiGridEdit1.GetValueList("Name", UiConfigClassDefinitionId", valList);
thanks again for any assistance...
SSSteve said:I'm starting to wonder if this has been a bad practice
As probably happens for you 50% of the time, while constructing a test app, I saw my glaring issue. :-D
thx again!