Hello, I have a dropdownlist that is being populated from a database. That is working fine. The nonselectvalue of the control is -1 and the nonselectlabel is "..". When I try to open an existing record for editing, I can't seem to select the correct row. There are three parts to the ID: 111A-DD-12345. When the record is returned from the database, the ID is parsed into the three fields. The first and third parts are textboxes on the page, but the middle part is a dropdownlist. When we open an existing record, we parse out the ID with the following code:
string[] chunks = cID.Split('-');
ddOffice.SelectedItem.Text = chunks[1];
But this just changes the first row of the ddl to DD (using the example ID above), so we end up with two rows in the ddl that have the same displayed text. How do I programmatically set the dropdownlist to the correct value?
Edit: We also tried ddOffice.SelectedValue = chunks[1] , but that just displays the .. of the default, non-selected row.
TIA, Theresa