Hi, I'm having some issues with setting SelectedValue on a dropdownlist.
In my application I have a site selection dropdownlist which helps distinguish different transaction sets.
When edits are currently being made in any of the screens and the user tries to change the site using the dropdownlist, it asks whether or not the user wants to continue (checkDirtyLabour() below). If the user chooses to NOT continue with the site change (stay on same form) I want to ensure the dropdownlist doesn't change as well - or in fact, in this case, reverts back to the original value.
As such I try to set rddlSite.SelectedValue = Globals.CurrentSite (shared public variable). I have also tried this with the currentGlobalSite. Neither of these things are working presently, when stepping over these lines the assignation doesn't cause any errors yet also doesn't assign the value. ValueMember for rddlSite = "LookupID" of the LookUpRow record. For instance, the default Globals.CurrentSite value is 7, and changing it to 9 via selection, then cancelling the change when prompted does not return the SelectedValue to 7.
If someone could help me figure out what's going on, I'd love some help.
The following snippet is in rddlSite_SelectedValueChanged
Dim lu As LookupRow = DirectCast(rddlSite.SelectedItem.DataBoundItem, LookupRow)
If lu.LookupID <> Globals.CurrentSite Then
Dim currentGlobalSite As Integer = Globals.CurrentSite
If Globals.CurrentSite > 0 AndAlso checkDirtyLabour() Then 'if dirty and selected to not change, but not when Globals.CurrentSite not set
rddlSite.SelectedValue = Globals.CurrentSite
lh.rddlSite.SelectedValue = Globals.CurrentSite
lh.rddlSite.Text = ""
Globals.CurrentSite = lu.LookupID
lh.rddlSite.SelectedText = lu.FieldID
If Globals.CurrentSite > 0 Then refreshLabourOnSiteChange()