|
-
Sep 5th, 2003, 03:25 PM
#1
Thread Starter
Junior Member
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>
Thanks,
Bill Yeager (BCIP, MCP)
BrainBench Certified Internet Professional
Microsoft Certified Professional
YeagerTech Consulting, Inc.
-
Sep 11th, 2003, 04:08 PM
#2
Thread Starter
Junior Member
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".....
Thanks,
Bill Yeager (BCIP, MCP)
BrainBench Certified Internet Professional
Microsoft Certified Professional
YeagerTech Consulting, Inc.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|