locked
populating listbox based on other control RRS feed

  • Question

  • User-1213473072 posted

    Hi All,

    I would like to make a form, in which one listbox would be populated based on other listbox.

    First listbox would have list of Categories, second - list of Subcategories, but filtered only to items connected with chosen Category.

    Is it posible to do this using WebMatrix and Razor?

    Tuesday, July 2, 2013 10:47 AM

Answers

All replies

  • User-1980594115 posted

    You can use exclusively WebMatrix and Razor, but the list of Categories would have to be submitted before the list of Subcategories will populate.  Most use javascript to accomplish this.  There are many options.  You can research for cascading dropdown lists.

     

    Tuesday, July 2, 2013 2:19 PM
  • User1713851783 posted

    If you want to use exclusively C# this thread could help: Cascading Selectboxes from Database.

    Else, if you would try to use jQuery, this excellent Mike Brind's article gives you what you need: WebMatrix - jQuery Cascading Dropdown Lists.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 2, 2013 4:01 PM