Hey folks,
I am currently struggling with a similar problem... the only difference to the example above is that I use a DropDownList WebControl and the mentioned SelectecItem.Value is a String so casting is not possible...
Basically I have to fill a look up DropDownList with the problem that the PK (nummer) is a composite one so I have to use
multiple fields as value for the DropDownList control items. Can I accomplish this using the integrated DataBinding Feature of the EntityCollection or do I have to make a workaround with string concatenation using SQL???
The UMO184 Entity consists of those field:
NUMMER (PK) Integer
LOCATIE (PK) Short
OMSCHR String
'load UMO184NRCollection
DropDownListUMO184NR.DataSource = LookupTableProvider.Umo184NrCollection()
DropDownListUMO184NR.DataTextField = "OMSCHR"
DropDownListUMO184NR.DataValueField = "NUMMER"
DropDownListUMO184NR.DataBind()
<--- snip --->
'grab the selected value
If (Not DropDownListUMO184NR.SelectedValue.Equals("0")) Then
UMO138.Umo184Nr = CType(DropDownListUMO184NR.SelectedValue, Integer)
UMO138.Umo184Loc = 0 ' here is the problem! How do I get the Value from the entity
Else
UMO138.SetNewFieldValue(DataAccess.Umo138FieldIndex.Umo184Loc, Nothing)
UMO138.SetNewFieldValue(DataAccess.Umo138FieldIndex.Umo184Nr, Nothing)
End If