Hello, I hope this is where I should post this.
I have a problem with this code that I can't figure out...seems to be a bug in the dropdownlist control.
I am trying to set multiple dropdownlists to match retrieved data. When I set the first, everything is fine. Then I set the second and the first gets set to the second index. Can you see anything wrong with this code? Thanks
If DR.HasRows Then
Do While DR.Read()
Dim name As String = DR.Item("position").ToString
Dim Type As String = DR.Item("Type").ToString
Dim Value As String = DR.Item("PositionID").ToString
Select Case Type.ToUpper
Case "ACMC"
Dim ACMCselectedItem As New System.Web.UI.WebControls.ListItem
ACMCselectedItem = cboACMC.Items.FindByValue(Value)
If Not (ACMCselectedItem Is Nothing) Then
cboACMC.SelectedIndex = cboACMC.Items.IndexOf(ACMCselectedItem)
End If
Case "CASAG"
Dim CASAGselectedItem As New System.Web.UI.WebControls.ListItem
CASAGselectedItem = cboCASAG.Items.FindByValue(Value)
If Not (CASAGselectedItem Is Nothing) Then
cboCASAG.SelectedIndex = cboCASAG.Items.IndexOf(CASAGselectedItem) <<<--- (this step resets cboACMC.SelectedIndex as well!!! I have watched it happen in debug.)
End If
Case "DESK"
Dim item As New System.Web.UI.WebControls.ListItem
item.Text = name
item.Value = DR.Item("PositionID").ToString
lstDeskOffices.Items.Add(item)
End Select
Loop
End If
thanks for any help you can give me..
--------------------------------
From: David Austin
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>04vPTV01T0mbVXp08ODeUw==</Id>