Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referring to enums
Message
De
31/01/2011 08:59:31
 
 
À
31/01/2011 08:36:49
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01497627
Message ID:
01497953
Vues:
20
>>>It is stored as an int in the table.
>>>
>>>I use MM.NET and this binds the combo to a BO so I don't actually manually set the datasource.
>>>
>>>I don't quite follow your suggestion (I'm still a baby when it comes to this .NET C# stuff and the terminology), but if you don't have the time to explain further, no problem as Bonnie's suggestion has worked for me.
>>
>>OK. I'm confused as to how the ComboBox.SelectedValue ends up as a string in that scenario - but as long as its working.......
>>( I assume you tested this with non-matching descriptions ?)
>>
>
>Hi Viv,
>
>It is MM magic where additional properties are added to the controls that allow binding for both the table that drives the display as well as the value and synchronizes to the child table where a foreign key is stored. I suspect the problem Frank was solving was how to know or compare the value for some other purpose other than or before the mm save was taking place. I don't really know if using a enum made this more complicated or not but he will certainly need to keep his enum values syncrhonized with the table driven values as well because of it.

What I didn't (and still don't) understand is:
(a) Frank says an int is used to store the enum value in the Lookup table.
(b) This table is the DataSource for the combo box.
(c) But..... the SelectedValue of the ComboBox is a string representation of an integer.
(which means that to compare it against any enum value the enum itself has to be converted to an int and then to a string.....)
So why/where did the .SelectedValue become a string ?

In that situation then using an enum is certainly more complicated than it need be......
Anyway, not important since it works and Frank's happy :-}
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform