Filter listbox contents client-side

I have a .Net web application created with c# using Visual Studio 2010.

On a web page a have a DropDownList containing containing a list of publishers.  Below that I have ListBox displaying books for the selected publisher.  I would like the list to update when the users selects a publisher in the DropDownList.  I can do this server-side but how can I do it client-side for quicker performance?
Who is Participating?
COBOLdinosaurConnect With a Mentor Commented:
Well you posted the asp code instead of the HTML, but in any case.  What you can do is generate each list into div that has a css property of display:hidden.  Then on the change event for the select.  Just swap in the innerHTML of the appropriate hidden element to the element holding the displayed list.

A link to the page would be helpful; or at the very least the HTML that the browser is seeing.

canuckconsultingAuthor Commented:
It is something I am developing.  Just an asp:DropDownList  followed by an asp:ListBox.  If it helps it will look like:

          <asp:DropDownList ID="DropDownList1" runat="server">
              <asp:ListItem Value="1">Publisher 1</asp:ListItem>
              <asp:ListItem Value="2">Publisher 2</asp:ListItem>
          <asp:ListBox ID="ListBox1" runat="server">
              <asp:ListItem Value="1,1">Book1</asp:ListItem>
              <asp:ListItem Value="1,2">Book 2</asp:ListItem>

Open in new window

canuckconsultingAuthor Commented:
Thanks for the help which worked fine.

In the end I used jquery and something similar to this do to the next requirement I had:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.