Link to home
Start Free TrialLog in
Avatar of codequest
codequest

asked on

Drop Down List From DataTable - Display One Value, Capture Associated Index

I'd like to have a set-up for a FormView Insert Template Field (call it "ListValue") ( for Table A ) that would act like this:

A)  A drop down list DD is populated from a datatable B (another table)
B)  When an item from the drop down list DD is selected
     i)  the item displayed in the drop down field shows on a field on the Template ("DisplayField")
    ii)  the Primary Key from the datatable B, associated with the drop down list selected item, would be bound to the Table A "List Value" field.

Any suggestions, starting points, etc would be appreciated.

Thanks!
Avatar of codequest
codequest

ASKER

I think I've got the answer.  I'm using TableAdapters.  So I need a Select Query with a Join (or sub-query) that will translate the stored ID value to the Display Value, and Insert/ Update Queries with a sub-query to translate the Display Value back to the ID value.  

This will work because there the Display Values are unique (so no ID confusion in the translation).

The Drop Down is a separate technical matter...it just happens to be the same file.
And then, of course, uh-duh, the Drop Down List control provides for a selected value as well as a display text, so...
ASKER CERTIFIED SOLUTION
Avatar of PAQ_Man
PAQ_Man
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial