Results 1 to 2 of 2

Thread: multiple selection listbox

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2003
    Location
    Weston, FL USA
    Posts
    17

    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.

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Aug 2003
    Location
    Weston, FL USA
    Posts
    17

    Red face 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
  •  



Click Here to Expand Forum to Full Width