We help IT Professionals succeed at work.
Get Started

List box help

DowntownIT
DowntownIT asked
on
238 Views
Last Modified: 2012-05-11
I have an accordion where I am creating each pane dynamically through code. I am then dynamically creating and adding a list box and list items to each of the panes. What I can’t figure out, is how to capture the selected value and text of any given list box. I also need to be able that if the user selects a item from the list box in any of the panes that all other selected list box items of the other panes are cleared.

Thanks for the help!
Public Sub BuildAccordion()

     
        Dim dt As DataTable = ListData1.DefaultView.ToTable("MyPanes", True, New [String]() {"Screen_no", "Screen_desc"})

        For Each row As DataRow In dt.Rows

            Dim myStrExpr As String
            myStrExpr = "screen_no = " & row("Screen_no").ToString
            Dim lbScreen As New ListBox

            For Each row1 As DataRow In ListData1.Select(myStrExpr)
                lbScreen.Items.Add(New ListItem(row1("Floor/Location/Position").ToString, "Seat_no"))
            Next

            CreateAccPane(row("Screen_desc").ToString, row("Screen_desc").ToString, lbScreen)
        Next
    End Sub

    Public Sub CreateAccPane(ByVal PaneID As String, ByVal PaneHeader As String, ByVal PaneContent As ListBox)
        Dim panel1 As AccordionPane = New AccordionPane
        panel1.ID = PaneID
        panel1.HeaderContainer.Controls.Add(New LiteralControl(PaneHeader))

        panel1.ContentContainer.Controls.Add(PaneContent)

        AccPositions.Panes.Add(panel1)

    End Sub

Open in new window

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE