multiple selection listbox
Is there a way to set the scroll position of a 1 row multiple selection listbox that is a template column from within the datagrid?
After I get values back from my db, I want to set the value to the first position that is selected in this listbox.
It always goes to the first position in the listbox and I know there is data in the drRider. While debugging, it shows a row count greater than 0 and alwasy goes inside the "If Not drRider Is Nothing" statement...
Here is my code:
<code>
For Each drShiftDate In dr
drRider = DsRider1.Riders.FindByUserID(drShiftDate.UserID) 'Find the UserID in the Rider listbox
If Not drRider Is Nothing Then
lstRiderTemp.Items.FindByValue(drShiftDate.UserID).Selected = True
lstRiderTemp.SelectedIndex = lstRiderTemp.Items.IndexOf(lstRiderTemp.Items.FindByValue(drShiftDate.UserID))
End If
End If
Next
</code>
multiple selection listbox
Can someone please explain to me why the following code is not working:
<code>
Dim li As ListItem
Dim z As Byte = 0
For Each li In lstSelectionRider.Items
If li.Selected = True Then
strRowNbr = "OrigRider" & z & "UserID" & bytRowNbr
viewstate.Item(strRowNbr) = strRiderUserName(0) End If
z += 1
li.Selected = False
End If
Next</code>
All I want to see is the item going inside the "IF" statement which it never does. Why??? I have the item selected in the listbox, and I'm hitting the "For Each" statement, but it never goes inside the "IF".....