hi
I have a Datatable (table1) which has 2 columns: "Name" and "USER-ID"
now I want to present the Names field in a DropDown-list (which I succeed
with)
but I want then to fetch the rows of an other DataTable (Table2) which has
3 columns: "USER-ID" "Address" "Telefon"
which correspond with the selected Table1.name (and USER-ID of course)
that correspond to the Table2.User-ID
I know how to refer to the selected.Item of my DropDownList with:
namechoice = DropDownlist_name.selectedItem
but how kan I get the value of the associated "USER-ID" of my choice
so that I kan fetch the corresponding rows from my Table2
------
Thank you for any help!
//F-J
Each item in a dropdown list can have two 'values' associated with it.
'text' and 'value'. The 'text' appears in the control but you can retrieve
either the 'text' or the 'value'. In VB you can do something like
ddlNames.Items.Add(New ListItem("Joe Smith", "12345"))
where Joe Smith is the 'text' field and appears on the control list and
'12345' coule be your ID Number. You can retrieve the ID Number
IdNum = ddlNames.SelectedItem.Value
Hope that helps.
John Ritchie