2
Answers

Problem with DropDownList

Elmar

Elmar

11y
1k
1
 I have 3 tables, DataGridView and DropDownList
TABLES:
tblACTIONS: ID, UnitID, etc
tblUNITS: UnitID, UnitName, LocationID
tblLOCATIONS: LocationID, Location
This is how I populate the grid
SELECT tblACTIONS.ID, tblUNITS.UnitName & ' - ' & tblLOCATIONS.Location AS XYZ,
FROM (((tblACTIONS INNER JOIN tblUNITS ON tblACTIONS.UnitID = tblUNITS.UnitID)
INNER JOIN tblLOCATIONS ON tblUNITS.LocationID = tblLOCATIONS.LocationID)
This is how I populate the Dropdown (ID1 – valuemem; XYZ –displaymem)
SELECT tblUNITS.UnitID AS ID1, tblUNITS.UnitName & ' - ' & tblLOCATIONS.Location AS XYZ
FROM tblUNITS INNER JOIN tblLOCATIONS ON tblUNITS.LocationID = tblLOCATIONS.LocationID
I'd like to click on the grid's row and to set the dropdownlist text
ddUnit.Text = dGr.Rows[e.RowIndex].Cells["XYZ"].Value.ToString();
But it doesn't work - the dropdownlist still has first blank unselected text. Can anybody point me to a solution (please)?
Answers (2)