Can I populate a DevExpress LookupEdit using an enum?


Author
Message
Peter Jones
Peter Jones
Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi,

I would like to use enums to populate a LookupEdit column in a DevExpress grid. I've worked my way to the BuildDataTableFromEnum method and that seemed to hold the clue but I can't work out how to use it. Before spending a lot of time on this I thought I had better ask if it is even possible. If it is, do you have a code snippet I could use?

Cheers, Peter

Replies
Peter Jones
Peter Jones
Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi,

Ok then. When I first looked at this issue that was the only method I could identify that could create an 'enum table'. Does SF have another method that will return the enum integer in the value column?

Cheers, Peter

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
I don't think we have one that will just get the integer value for the enum.  We originally had all of the method return a DataTable with the value column populated with an integer, but we discovered that you couldn't bind to a strong-typed property that had been typed as an enum, but you can bind an enum populated combo box to an integer-typed property, so we changed the methods to populate the value column with the actual enum value.  This all happened in version 1.1 or 1.2, I'm not sure. 

If you want to be able to populate a column with the integer value, you can use the CreateDataTableFromEnum method and add an extra column, say "ValueInt", to the table, cycle through the rows, and set the integer value.  Then you'll just have to change the ValueMember of the control to "ValueInt", not "value".

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search