Trying to grab multiple selections from a Checkboxlist

Discussion in 'ASP .Net' started by Zak, Jun 14, 2007.

  1. Zak

    Zak Guest

    Hello,

    I need some help trying to grab the data selected from a checkboxlist. The
    checklist is acting like a menu. The first selection is accepted but not the
    multiple ones. For example is the user selects "Checked Baggage" the
    selection is stored the correct procedure is processed, but if the user
    selects "SIDA" along with the "Checked Baggage" there is no stored data,
    just that first selection. Just the first entry is saved. Can someone help
    me figure out how to get multiple selections stored so I can get this menu
    to work? Thanks in advance for the assistance!

    Dim item As ListItem
    For Each item In cklAirportAreas.Items
    If item.Selected = True Then

    Select Case item.Text
    Case "Checked Baggage"
    CheckedBaggage = "Yes"

    Case "Cargo"
    Cargo = "Yes"

    Case "Checkpoint"
    Checkpoint = "Yes"

    Case "Terminal"
    Terminal = "Yes"

    Case "SIDA"
    SIDA = "Yes"

    Case "AOA"
    AOA = "Yes"

    Case "Perimeter"
    Perimeter = "Yes"
    Case "Other"
    Other = "Yes"
    Case Else
    MsgBox("An error has occurred please try again!")
    End Select
    End If

    Next

    Whatever is selected in from the Checkboxlist is accepted but when the
    program goes to the next sections is where I get the issue:
    'First button
    If CheckedBaggage = "Yes" Then
    plCkBaggage.Visible = True

    Else
    If Cargo = "Yes" Then
    plCargo.Visible = True

    Else
    If Checkpoint = "Yes" Then
    plCheckpoint.Visible = True

    Else
    If Terminal = "Yes" Then
    plTerminal.Visible = True
    Else
    If SIDA = "Yes" Then
    plSIDA.Visible = True
    Else

    If AOA = "Yes" Then
    plAOA.Visible = True
    Else
    If Perimeter = "Yes" Then
    plPerimeter.Visible = True

    Else
    If Other = "Yes" Then
    plOther.Visible = True

    End If
    End If
    End If
    End If
    End If
    End If
    End If
    End If
    End Sub

    okay the program goes through this correctly but the next section, it
    doesn't. I am trying to use the checkboxlist as a menu....The user selects
    for example Checked Baggage, and then selects Cargo...well it goes to
    Checked Baggage, the first on the list but not the next one, Cargo....here
    is the code..
    'Second button where there is no data....
    If Cargo = "Yes" Then
    plCargo.Visible = True

    Else
    If Checkpoint = "Yes" Then
    plCheckpoint.Visible = True

    Else
    If Terminal = "Yes" Then
    plTerminal.Visible = True
    Else
    If SIDA = "Yes" Then
    plSIDA.Visible = True

    Else

    If AOA = "Yes" Then
    plAOA.Visible = True
    Else
    If Perimeter = "Yes" Then
    plPerimeter.Visible = True

    Else <<<<<<<<<<For some reason instead of
    going to Cargo it goes here....
    If Other = "Yes" Then
    plOther.Visible = True

    Else
    plCCTVNeeds.Visible = True

    End If
    End If
    End If
    End If
    End If
    End If
    End If


    Please help me fix this problem. Thank you.
    Zak, Jun 14, 2007
    #1
    1. Advertising

  2. Your code will never show cargo panel if CheckedBagage item is checked.
    Did you have to use "End if" instead of else in the following code:

    If CheckedBaggage = "Yes" Then
    plCkBaggage.Visible = True

    Else
    If Cargo = "Yes" Then
    plCargo.Visible = True

    Else


    -yuriy

    > Hello,
    >
    > I need some help trying to grab the data selected from a checkboxlist.
    > The checklist is acting like a menu. The first selection is accepted
    > but not the multiple ones. For example is the user selects "Checked
    > Baggage" the selection is stored the correct procedure is processed,
    > but if the user selects "SIDA" along with the "Checked Baggage" there
    > is no stored data, just that first selection. Just the first entry is
    > saved. Can someone help me figure out how to get multiple selections
    > stored so I can get this menu to work? Thanks in advance for the
    > assistance!
    >
    > Dim item As ListItem
    > For Each item In cklAirportAreas.Items
    > If item.Selected = True Then
    > Select Case item.Text
    > Case "Checked Baggage"
    > CheckedBaggage = "Yes"
    > Case "Cargo"
    > Cargo = "Yes"
    > Case "Checkpoint"
    > Checkpoint = "Yes"
    > Case "Terminal"
    > Terminal = "Yes"
    > Case "SIDA"
    > SIDA = "Yes"
    > Case "AOA"
    > AOA = "Yes"
    > Case "Perimeter"
    > Perimeter = "Yes"
    > Case "Other"
    > Other = "Yes"
    > Case Else
    > MsgBox("An error has occurred please try again!")
    > End Select
    > End If
    > Next
    >
    > Whatever is selected in from the Checkboxlist is accepted but when the
    > program goes to the next sections is where I get the issue:
    > 'First button
    > If CheckedBaggage = "Yes" Then
    > plCkBaggage.Visible = True
    > Else
    > If Cargo = "Yes" Then
    > plCargo.Visible = True
    > Else
    > If Checkpoint = "Yes" Then
    > plCheckpoint.Visible = True
    > Else
    > If Terminal = "Yes" Then
    > plTerminal.Visible = True
    > Else
    > If SIDA = "Yes" Then
    > plSIDA.Visible = True
    > Else
    > If AOA = "Yes" Then
    > plAOA.Visible = True
    > Else
    > If Perimeter = "Yes" Then
    > plPerimeter.Visible = True
    > Else
    > If Other = "Yes" Then
    > plOther.Visible = True
    > End If
    > End If
    > End If
    > End If
    > End If
    > End If
    > End If
    > End If
    > End Sub
    > okay the program goes through this correctly but the next section, it
    > doesn't. I am trying to use the checkboxlist as a menu....The user
    > selects
    > for example Checked Baggage, and then selects Cargo...well it goes to
    > Checked Baggage, the first on the list but not the next one,
    > Cargo....here
    > is the code..
    > 'Second button where there is no data....
    > If Cargo = "Yes" Then
    > plCargo.Visible = True
    > Else
    > If Checkpoint = "Yes" Then
    > plCheckpoint.Visible = True
    > Else
    > If Terminal = "Yes" Then
    > plTerminal.Visible = True
    > Else
    > If SIDA = "Yes" Then
    > plSIDA.Visible = True
    > Else
    >
    > If AOA = "Yes" Then
    > plAOA.Visible = True
    > Else
    > If Perimeter = "Yes" Then
    > plPerimeter.Visible = True
    > Else <<<<<<<<<<For some reason instead
    > of
    > going to Cargo it goes here....
    > If Other = "Yes" Then
    > plOther.Visible = True
    > Else
    > plCCTVNeeds.Visible = True
    > End If
    > End If
    > End If
    > End If
    > End If
    > End If
    > End If
    > Please help me fix this problem. Thank you.
    >
    Yuriy Solodkyy, Jun 15, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bill yeager

    multiple listbox selections

    bill yeager, Aug 12, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    429
    bill yeager
    Aug 12, 2003
  2. Brian K. Williams

    CheckBoxList Not Retaining selections

    Brian K. Williams, Sep 8, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    407
    Brian K. Williams
    Sep 8, 2004
  3. =?Utf-8?B?QWRpcw==?=
    Replies:
    0
    Views:
    375
    =?Utf-8?B?QWRpcw==?=
    Oct 19, 2004
  4. John Hoge

    Bind multiple selections to a query

    John Hoge, Nov 30, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,180
    John Hoge
    Nov 30, 2004
  5. Steffen Loringer

    Multiple selections in dropdownlist

    Steffen Loringer, Aug 11, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    3,334
    Mark Rae
    Aug 11, 2005
Loading...

Share This Page