ASP.NET MVC ListBox - Single Item Selection


  • Zimbabwe230
  • Zambia229
  • Yemen228
  • Wallis and Futuna227
  • Wales226
  • Virgin Islands225
  • Vietnam224
  • Venezuela223
  • Vatican City222
  • Vanuatu221
  • Uzbekistan220
  • USA219
  • Uruquay218
  • United Arab Emirates217
  • Ukraine216
The ListBox provides two selection modes:
  • single item selection - when using this mode, only an item from the list can be selected at a time;
  • multi item selection - when using this mode, the end user can select multiple items (using CTRL + click);

To enable one selection mode or the other, use the SelectionMode property, which can be set either
to Single or Multiple.
View - Aspx

    <% Html.Obout(new ListBox("ListBox1")
    {   
        SelectionMode = ListBoxSelectionMode.Single
    }); %> 
    
    
View - Razor

    @Html.Obout(new ListBox("ListBox1")
    {   
        SelectionMode = ListBoxSelectionMode.Single
    })